<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
	<title>Krishna&#39;s Webplace</title>
	<link>https://krishnayadav.xyz/</link>
	<description>Recent content on Krishna&#39;s Webplace</description>
	<generator>Hugo -- gohugo.io</generator>
	<language>en-us</language>
	<lastBuildDate>Fri, 03 May 2024 15:13:53 +0530</lastBuildDate>
    
        <atom:link href="https://krishnayadav.xyz/index.xml" rel="self" type="application/rss+xml" />
	
	
	<item>
		<title>Ubuntu Server Setup Part 2: Installing Nextcloud</title>
		<link>https://krishnayadav.xyz/blog/ubuntu-server-setup-part-2-installing-nextcloud/</link>
		<pubDate>Sat, 22 Jun 2024 20:35:26 +0530</pubDate>
		
		<guid>https://krishnayadav.xyz/blog/ubuntu-server-setup-part-2-installing-nextcloud/</guid>
		<description>&lt;p&gt;I finally setup my Ubuntu server quite well along with wifi drivers.&lt;/p&gt;
&lt;p&gt;Next up, I had to install Nextcloud, because I wanted a cloud storage that could backup and sync photos, videos and other stuff from several devices at my home. Thus I looked up a tutorial on it and found one by Jay, which was extremely easy to follow and helped me setup my Nextcloud instance from scratch.&lt;/p&gt;
&lt;p&gt;The steps to do the same are as follows:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;You should be using a normal user account, and should not be executing the commands as &amp;lsquo;root&amp;rsquo;. In case you are &amp;lsquo;root&amp;rsquo;, simply execute the following:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-console&#34; data-lang=&#34;console&#34;&gt;adduser &amp;lt;Enter your desired username here&amp;gt;
usermod -aG sudo &amp;lt;Enter the username you set above&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Update the system&amp;rsquo;s cache and also apply any pending updates with the following command:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-console&#34; data-lang=&#34;console&#34;&gt;sudo apt update &amp;amp;&amp;amp; sudo apt dist-upgrade
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Now, let us download and install php, mariadb and apache (along with some additional dependencies and required packages):&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-console&#34; data-lang=&#34;console&#34;&gt;sudo apt install libmagickcore-6.q16-6-extra php php-apcu php-bcmath php-cli php-common php-curl
php-gd php-gmp php-imagick php-intl php-mbstring php-mysql php-zip php-xml apache2 unzip 
mariadb-server redis-server php-redis -y
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;em&gt;Note:&lt;/em&gt; You can check if apache is running [Should be active and enabled] with:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-console&#34; data-lang=&#34;console&#34;&gt;systemctl status apache2
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Download and unzip nextcloud with:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-console&#34; data-lang=&#34;console&#34;&gt;wget https://download.nextcloud.com/server/releases/latest.zip
unzip latest.zip
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;We will now change the ownership of nextcloud to the group and user &amp;lsquo;www-data&amp;rsquo; and move the nextcloud folder into the &amp;lsquo;/var/www/&amp;rsquo; directory as SOP. The &amp;lsquo;www-data&amp;rsquo; is a user (and group) created by default when we installed apache2. The &lt;strong&gt;-R&lt;/strong&gt; flag changes ownership of all files and folders within the nextcloud directory recursively.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-console&#34; data-lang=&#34;console&#34;&gt;sudo chown www-data:www-data -R nextcloud
sudo mv nextcloud /var/www/
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;PHP needs some modules to be enabled for it&amp;rsquo;s functioning. Do so with:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-console&#34; data-lang=&#34;console&#34;&gt;sudo phpenmod imagick intl bcmath gmp  
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Let us start configuring database, which is required to base our Nextcloud on. We must first run a setup of mysql to secure our installation. To do so, run:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-console&#34; data-lang=&#34;console&#34;&gt;sudo mysql_secure_installation
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;It will open a console asking you to fill certain details.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The first prompt will be asking for default root password, just press Enter button to skip this option.&lt;/li&gt;
&lt;li&gt;Next it will ask for Unix socket, &lt;strong&gt;type &amp;lsquo;n&amp;rsquo;&lt;/strong&gt; and proceed.&lt;/li&gt;
&lt;li&gt;Then it will ask to enter a password, &lt;strong&gt;type &amp;lsquo;y&amp;rsquo;&lt;/strong&gt; and then enter a password (store it securely).&lt;/li&gt;
&lt;li&gt;Just keep pressing Enter button to skip through rest of the options (Capital letter means default option, &lt;strong&gt;&amp;lsquo;Y&amp;rsquo;&lt;/strong&gt; in all these options).&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Once done with this, we must now configure mariadb. Open it&amp;rsquo;s shell by:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-console&#34; data-lang=&#34;console&#34;&gt;sudo mariadb
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In this shell, type these commands (replace where marked):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;CREATE DATABASE nextcloud;&lt;/li&gt;
&lt;li&gt;GRANT ALL PRIVILEGES ON nextcloud.* TO &amp;lsquo;nextcloud&amp;rsquo;@&amp;lsquo;localhost&amp;rsquo; IDENTIFIED BY &amp;lt;&amp;lsquo;Enter a secure password here for the db. Do keep the password inside single inverted commas.&#39;&amp;gt;;&lt;/li&gt;
&lt;li&gt;FLUSH PRIVILEGES;&lt;/li&gt;
&lt;li&gt;exit;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; Store this password very securely, as it can be misused if leaked.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;We should now generate our own SSL/TLS certificate to use with our server (In case you have a static IP, you should use Let&amp;rsquo;s encrypt&amp;rsquo;s certificate using &lt;a href=&#34;https://certbot.eff.org/&#34;&gt;Certbot&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; This command will ask you several question. Answer whatever you want to fill in (won&amp;rsquo;t have much effect).&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-console&#34; data-lang=&#34;console&#34;&gt;mkdir $HOME/certs &amp;amp;&amp;amp; cd $HOME/certs/
&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&lt;/span&gt;openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 3650 -nodes
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; Please store both the key.pem and cert.pem somewhere secured. Also import cert.pem as an Authorities certificate in your browser to avoid the browser from flagging our nextcloud instance as a &amp;lsquo;Not Secure&amp;rsquo; website everytime we visit it.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Now we must disable the default webpage of apache, place our config file in the apache directory and enable the config for apache to load the nextcloud page (Along with adding Strict Transport Security).&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-console&#34; data-lang=&#34;console&#34;&gt;sudo a2dissite 000-default.conf
&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&lt;/span&gt;sudo nano /etc/apache2/sites-available/nextcloud.conf
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In the text editor which opens, paste the following code:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-console&#34; data-lang=&#34;console&#34;&gt;&amp;lt;VirtualHost *:80&amp;gt;
&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&lt;/span&gt;    RewriteEngine On
    RewriteCond %{SERVER_PORT} !443
    RewriteRule ^(/(.*))?$ https://%{HTTP_HOST}/$1 [R=301,L]
&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&lt;/span&gt;&amp;lt;/VirtualHost&amp;gt;
&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&lt;/span&gt;&amp;lt;VirtualHost *:443&amp;gt;               
    DocumentRoot &amp;#34;/var/www/nextcloud&amp;#34;
&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&lt;/span&gt;    SSLCertificateFile $HOME/certs/cert.pem
    SSLCertificateKeyFile $HOME/certs/key.pem
    SSLEngine on
&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&lt;/span&gt;    &amp;lt;Directory &amp;#34;/var/www/nextcloud/&amp;#34;&amp;gt;
        Options MultiViews FollowSymlinks
        AllowOverride All
        Order allow,deny
        Allow from all
    &amp;lt;/Directory&amp;gt;
&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&lt;/span&gt;    TransferLog /var/log/apache2/nextcloud_access.log
    ErrorLog /var/log/apache2/nextcloud_error.log
&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&lt;/span&gt;    &amp;lt;IfModule mod_headers.c&amp;gt;
        Header always set Strict-Transport-Security &amp;#34;max-age=15552000; includeSubDomains&amp;#34;
    &amp;lt;/IfModule&amp;gt;
&amp;lt;/VirtualHost&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Save this file by doing ctrl+o and ctrl+x. Then enable this config file using:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-console&#34; data-lang=&#34;console&#34;&gt;sudo a2ensite nextcloud.conf
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Let us tune PHP to make our server run more efficiently:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: PHP versions can differ on different distributions, like 8.3 on Ubuntu 24 LTS and 8.1 on 22 LTS, thus press tab as directed below:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-console&#34; data-lang=&#34;console&#34;&gt;sudo nano /etc/php/&amp;lt;press tab to autocomplete here&amp;gt;/apache2/php.ini
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Find and edit the file by change stuff inside it according to this (Replace the areas where you see fit. To remove a comment, remove the &amp;lsquo;;&amp;rsquo; semi-colon in front of the line in the file):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;memory_limit = 2G&lt;/li&gt;
&lt;li&gt;upload_max_filesize = 20G&lt;/li&gt;
&lt;li&gt;max_execution_time = 360&lt;/li&gt;
&lt;li&gt;post_max_size = 20G&lt;/li&gt;
&lt;li&gt;date.timezone = Asia/Kolkata&lt;/li&gt;
&lt;li&gt;opcache.enable=1&lt;/li&gt;
&lt;li&gt;opcache.interned_strings_buffer=16&lt;/li&gt;
&lt;li&gt;opcache.max_accelerated_files=10000&lt;/li&gt;
&lt;li&gt;opcache.memory_consumption=128&lt;/li&gt;
&lt;li&gt;opcache.save_comments=1&lt;/li&gt;
&lt;li&gt;opcache.revalidate_freq=1&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Some modules are required by apache2, so enable them for use with nextcloud.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-console&#34; data-lang=&#34;console&#34;&gt;sudo a2enmod dir env headers mime rewrite ssl
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Enable the apcu module in php. This module caches data in memory, so helps in reducing database queries and file system operations. This also allows the occ script to function.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: PHP versions can differ on different distributions, like 8.3 on Ubuntu 24 LTS and 8.1 on 22 LTS, thus press tab as directed below:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-console&#34; data-lang=&#34;console&#34;&gt;echo &amp;#34;apc.enable_cli=1&amp;#34; | sudo tee -a /etc/php/&amp;lt;press tab here&amp;gt;/mods-available/apcu.ini
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Finally, let us restart apache2 to get nextcloud working:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-console&#34; data-lang=&#34;console&#34;&gt;sudo systemctl restart apache2
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;hr&gt;
&lt;p&gt;Create an administrator account in the webpage that opens when you visit the IP address / URL that you attached to the server. Then when you scroll down, it will ask for your database details. Fill according to what you entered in the above steps (db account and name should be &amp;lsquo;nextcloud&amp;rsquo; and password will be the one you entered while configuring mariadb, step 7).&lt;/p&gt;
&lt;p&gt;Sign in and setup nextcloud as you like. Next, head over to the Admin settings by clicking on your profile on top right side and then on &amp;ldquo;Administration settings&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://krishnayadav.xyz/img/admin_settings_nextcloud.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;
&lt;p&gt;In here, you will see the various issues that nextcloud has automatically detected with the installation. I cannot give solutions to all the issues present over there, but some of them which I had faced personally are as follows:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;If you get a very big error which states that the database is missing some indices, simply do as follows:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-console&#34; data-lang=&#34;console&#34;&gt;sudo chmod +x /var/www/nextcloud/occ                                      
&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&lt;/span&gt;sudo -u &amp;#39;www-data&amp;#39; /var/www/nextcloud/occ db:add-missing-indices          
&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&lt;/span&gt;sudo chmod -x /var/www/nextcloud/occ                                      
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This adds the missing indices using occ script provided by nextcloud themselves, which helps in correcting issues with nextcloud.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Enable memory caching:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-console&#34; data-lang=&#34;console&#34;&gt;sudo nano /var/www/nextcloud/config/config.php
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In the text editor which opens, add the following line somewhere in between the other lines (before the closing bracktes atleast):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&amp;lsquo;memcache.local&amp;rsquo; =&amp;gt; &amp;lsquo;\OC\Memcache\APCu&amp;rsquo;,&lt;/li&gt;
&lt;li&gt;&amp;lsquo;default_phone_region&amp;rsquo; =&amp;gt; &amp;lsquo;IN&amp;rsquo;,&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; Replace phone region code to whatever your region code is. Also, remember to have those commas in the end of each of the above 2 lines.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Additional security parameter is to lock down the config.php file to root group, as it contains sensitive information like our database password.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-console&#34; data-lang=&#34;console&#34;&gt;sudo chmod 660 /var/www/nextcloud/config/config.php
&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;
&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;&lt;/span&gt;sudo chown root:www-data /var/www/nextcloud/config/config.php
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;hr&gt;
&lt;p&gt;After doing this much, you can restart apache and/or even reboot your system once.&lt;/p&gt;
&lt;p&gt;Now I think you will be good to go with your own personal cloud storage. Remember to keep your system updated and files backed up (like 3-2-1 rule) to be safe.&lt;/p&gt;
</description>
	</item>
	
	<item>
		<title>Whatsapp Without Phone</title>
		<link>https://krishnayadav.xyz/blog/whatsapp-without-phone/</link>
		<pubDate>Wed, 29 May 2024 20:43:23 +0530</pubDate>
		
		<guid>https://krishnayadav.xyz/blog/whatsapp-without-phone/</guid>
		<description>&lt;h3 id=&#34;yes-whatsapp-without-its-app-on-phone-you-read-it-right&#34;&gt;Yes, whatsapp without it&amp;rsquo;s app on phone, you read it right.&lt;/h3&gt;
&lt;p&gt;I had stopped using whatsapp because I didn&amp;rsquo;t want to have it&amp;rsquo;s &amp;ldquo;proprietary&amp;rdquo; app on my degoogled device.&lt;/p&gt;
&lt;p&gt;But you see, this application is used by most of my academic professors and other colleages, so I had to somehow use it (without the app on my phone, of course).&lt;/p&gt;
&lt;p&gt;So I thought of running it through some android emulator, but didn&amp;rsquo;t want to natively run it on my linux machine.&lt;/p&gt;
&lt;p&gt;Thus I installed Windows 10 through virtual box and then installed bluestacks in it. But bluestacks was not starting properly (issues with virtualization).&lt;/p&gt;
&lt;p&gt;Had to &lt;strong&gt;enable&lt;/strong&gt; the following 2 options to get virtualization working:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://krishnayadav.xyz/img/enable_virt.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;If this still doesn&amp;rsquo;t work for you, I think you should also enable Virtualization and Hyper-V support from &amp;ldquo;Turn on windows features&amp;rdquo; from within your Windows VM.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;After this, bluestacks started working normally and I installed whatsapp normally in it and logged in to my account &lt;em&gt;[A strange thing was that all my chats and groups were gone, but maybe that was because I was logging in after around 1 month].&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;My next major work was to get whatsapp web working, so that I could use it on my other devices (of course, not going to run the emulator each time I have to use it).&lt;/p&gt;
&lt;p&gt;To do so, whatsapp requires web versions to have their QR code scanned by the whatsapp application for login, thus I used a usb camera that I had with me, but I got this error when I tried to use the webcam in my Windows VM:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://krishnayadav.xyz/img/cam_notFound_big.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;
&lt;p&gt;It required a bit of work to implement a &amp;ldquo;Webcam Passthrough&amp;rdquo;, so that the VM instance could access the USB camera.&lt;/p&gt;
&lt;p&gt;The steps were as follows [&lt;a href=&#34;https://askubuntu.com/a/1237808&#34;&gt;Credits&lt;/a&gt;]:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;First install certain extra packages to get stuff working:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;sudo apt-get install virtualbox-guest-additions-iso virtualbox-ext-pack
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Next, we need to find our webcam details using this:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;VBoxManage list webcams
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This should show us a list of (for me only 1) webcam/s attached to your host device.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Now finally we need to connect this webcam to enable passthrough. Issue this command, by replacing the word &lt;strong&gt;Windows&lt;/strong&gt; with the name of your VM instance and the .1 with the number that corresponds to your webcam as listed in step 2 (in most cases, it should be .1):&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;NOTE: This command must be run only when your windows VM is running.&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;VBoxManage controlvm &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Windows&amp;#34;&lt;/span&gt; webcam attach .1
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&#34;https://krishnayadav.xyz/img/list_Webcam.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;NOTE: If you shutdown or restart your VM, it will loose access to the camera. You need to re-run the step 3 command to get it working.&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;With this much, my VM was able to detect the webcam and without much difficulty, I was able to register with the whatsapp web version on my devices.&lt;/p&gt;
&lt;p&gt;A small caveat though, remember to open the whatsapp in your windows VM every 14 days to avoid getting logged out of your whatsapp web devices.&lt;/p&gt;
</description>
	</item>
	
	<item>
		<title>Sign a Custom ROM Build</title>
		<link>https://krishnayadav.xyz/blog/sign-a-custom-rom-build/</link>
		<pubDate>Sun, 26 May 2024 21:05:20 +0530</pubDate>
		
		<guid>https://krishnayadav.xyz/blog/sign-a-custom-rom-build/</guid>
		<description>&lt;h3 id=&#34;this-guide-will-explain-how-to-sign-a-custom-rom-build-typically-unofficial-builds-as-most-official-roms-are-now-shipping-their-own-private-keys&#34;&gt;This guide will explain how to &lt;strong&gt;sign&lt;/strong&gt; a Custom ROM build (typically unofficial builds, as most official ROMs are now shipping their own private keys).&lt;/h3&gt;
&lt;p&gt;I will use the &lt;a href=&#34;https://wiki.lineageos.org/signing_builds&#34;&gt;Lineage wiki guide&lt;/a&gt;, but simplify it in my own words at places where I feel this guide did not give more practical information to a new comer like me.&lt;/p&gt;
&lt;p&gt;The steps to &lt;strong&gt;Generate the keys&lt;/strong&gt; are as follows:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;NOTE&lt;/strong&gt;: You only need to run this once. If you ever rerun these, you’ll need to migrate between builds.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Go to the directory where all yours rom files are originally synced (the root of your custom rom files). Now open a terminal and issue this command:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;NOTE&lt;/strong&gt;: Please note this beforehand that running the following code will ask you to enter password for several keys and several number of times. I will say that just enter 1 password and copy+paste it on all the places where it asks for a password to be entered.&lt;/p&gt;
&lt;h4 id=&#34;_do-note-this-password-down-as-we-will-have-to-use-it-when-we-sign-the-builds_&#34;&gt;&lt;em&gt;DO NOTE THIS PASSWORD DOWN, as we will have to use it when we sign the builds.&lt;/em&gt;&lt;/h4&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;subject&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;/C=US/ST=California/L=Mountain View/O=Android/OU=Android/CN=Android/emailAddress=android@android.com&amp;#39;&lt;/span&gt;
mkdir ~/.android-certs
&lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; cert in bluetooth cyngn-app media networkstack platform releasekey sdk_sandbox shared testcert testkey verity; &lt;span style=&#34;color:#66d9ef&#34;&gt;do&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;\
&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;&lt;/span&gt;    ./development/tools/make_key ~/.android-certs/$cert &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;$subject&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;; &lt;span style=&#34;color:#ae81ff&#34;&gt;\
&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;done&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Now we need are required to re-sign APEX keys. To do so, simply run the following:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;cp ./development/tools/make_key ~/.android-certs/
sed -i &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;s|2048|4096|g&amp;#39;&lt;/span&gt; ~/.android-certs/make_key
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Now finally, we must generate our keys. I will strongly recommend you to generate them &lt;strong&gt;with&lt;/strong&gt; a password (re-use the password you used in step 1).&lt;/p&gt;
&lt;p&gt;The command to run is in &lt;a href=&#34;https://wiki.lineageos.org/signing_builds#generate-keys-with-a-password&#34;&gt;here&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;NOTE&lt;/strong&gt;: If you have issues following up with these steps, I have a script that will execute the commands for you (of course, you have to manually enter the password for each keys). You can find that script &lt;a href=&#34;https://github.com/ObsidianMaximus/scripts/blob/master/signing/Generate_Keys.sh&#34;&gt;here&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Usage (copy paste this in terminal):&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;curl -O https://raw.githubusercontent.com/ObsidianMaximus/scripts/master/signing/Generate_Keys.sh
bash Generate_Keys.sh
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Now, the steps to &lt;strong&gt;make a .zip flashable package&lt;/strong&gt; are as follows:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Source the envsetup.sh by executing this command:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;source build/envsetup.sh
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Now finally, we will have to start compiling the files for our custom ROM (this will take a long time, depending on your computer&amp;rsquo;s specs). To do so, run the following command (replacing the codename with your device codename):&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;breakfast &amp;lt;codename&amp;gt;
mka target-files-package otatools
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Now, it is time to sign all of our APKs and APEXes and build the .zip package.&lt;/p&gt;
&lt;p&gt;We will use 2 environment variables to ease our task, as they will allow us to sign without having to enter the password several times. For that, we must issue these 2 commands in the terminal:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;export ANDROID_PW_FILE&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;/path/to/your/password/file
export EDITOR&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;your_preferred_text_editor
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;NOTE&lt;/strong&gt;: &lt;em&gt;Replace the fields above as required. For the &lt;strong&gt;ANDROID_PW_FILE&lt;/strong&gt;, just create a file somewhere and input its path there. As for the &lt;strong&gt;EDITOR&lt;/strong&gt; variable, choose whichever editor you like (eg. vim, nano, codium, etc).&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Next run the following commands to call the script to start signing:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;curl -O https://raw.githubusercontent.com/ObsidianMaximus/scripts/master/signing/Sign.sh
bash Sign.sh
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;NOTE&lt;/strong&gt;: &lt;em&gt;This script will invoke a command &amp;ldquo;&lt;strong&gt;sign_target_files_apks&lt;/strong&gt;&amp;rdquo;, which should open the editor which you specified above, but if it does not, then open the file that you had given above in &lt;strong&gt;&amp;ldquo;ANDROID_PW_FILE&amp;rdquo;&lt;/strong&gt; and you should have stuff inside of it with empty spaces in these &amp;ldquo;[[[      ]]]&amp;rdquo; brackets.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Fill the password in this empty space for all the apks [make sure to fill it between the 3 left and 3 right brackets], and then save this file, and re-run the above script by simple doing: &lt;strong&gt;&lt;code&gt;bash Sign.sh&lt;/code&gt;&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;NOTE&lt;/strong&gt;: Wait patiently, it can take some time to do all of the above process.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Congratulations, you have successfully signed the build. Now in case you are wondering where the .zip file is (no, it is not in the usual out/ directory), the .zip is right in the android root tree, where you issued the commands from.&lt;/p&gt;
&lt;p&gt;Just clean flash the &lt;strong&gt;signed-ota_update.zip&lt;/strong&gt; and device integrity should be met now.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; &lt;em&gt;Just confirmed that dirty flashing this build over the previous unsigned ROM also works!&lt;/em&gt;&lt;/p&gt;
</description>
	</item>
	
	<item>
		<title>Ubuntu Server Setup Part 1</title>
		<link>https://krishnayadav.xyz/blog/ubuntu-server-setup-part-1/</link>
		<pubDate>Tue, 30 Apr 2024 19:46:03 +0530</pubDate>
		
		<guid>https://krishnayadav.xyz/blog/ubuntu-server-setup-part-1/</guid>
		<description>&lt;p&gt;I was wanting to learn on how to setup my servers and host stuff on them, but to host a server online, one needs to spend some amount of money on them, which i really didn&amp;rsquo;t want to. But then i remembered that i have one old dusty home computer that had been lying in my home since several years, while not really being used anymore.&lt;/p&gt;
&lt;p&gt;So i decided to use this opportunity to reuse the same computer for my server tasks and in this way, i will be saving up on those server costs that i would have to pay [electricity is cheap here].&lt;/p&gt;
&lt;p&gt;But i had a hurdle in my path, and that was my old monitor not working, due to which i was unable to get my cpu to give a basic display as it had only VGA output. And well, i couldn&amp;rsquo;t really use this PC with my current monitor, as this monitor supports only HDMI and Display Port. I did have one VGA-to-HDMI converter lying around with me, but that had malfunctioned as well.&lt;/p&gt;
&lt;p&gt;This had me worried for some time before i thought of just using the gpu in my current setup on the older one. Sadly, this had another issue. The older desktop is an Intel Pentium E5400, and has a motherboard which is of LGA775 socket type. Now, this motherboard has the onboard power supply cables right above the PCIe slot, which rendered me placing my hefty gpu in that slot useless.&lt;/p&gt;
&lt;p&gt;Then i had to think a bit more and got an idea of just taking out the HDD from the old PC and placing it in my working desktop [silly me]. I attached the HDD to my newer PC and started the machine.&lt;/p&gt;
&lt;p&gt;At first, i went for the trusted server OS, Debian. Flashed it onto my usb drive and tried live booting only to be suprised with no display. Forgot that i had to enable CSM from BIOS and then turn on &amp;ldquo;legacy only&amp;rdquo; mode to allow the usb to boot [had partitioned it as MSDOS/MBR, silly me, again..]. This was again because the older computer had legacy BIOS only and i had to test the current HDD to ensure that it did boot alright under legacy conditions.&lt;/p&gt;
&lt;p&gt;Adjusted boot options and booted the PC only to be met by a weirdly enlarged debian graphical installer. Pressed enter and the PC restarted and i was met with just blurred out lines and teared display with the text not legible at all. Tried rebooting several times from my usb drive but was met with the same issue again and again. Finally got quite frustrated and flashed ubuntu server on the drive.&lt;/p&gt;
&lt;p&gt;Booted from it and to my surprise, it turned on smoothly. At first the screen was enlarged but when i progressed the installation, it auto-adjusted normally and matched my 24&amp;quot; screen resolution quite well. Installed the ubuntu server, which was pretty straight forward, thanks to the KIS ways of Ubuntu.&lt;/p&gt;
&lt;p&gt;Then my next task was getting my wifi modem or should i say TP-Link USB Network Adapter (Archer T2U Plus) in working condition, as i planned to keep the pc in an isolated place. &lt;strong&gt;The instructions for the same can be found &lt;a href=&#34;https://github.com/ObsidianMaximus/wifidrivers/blob/master/commands_for_drivers.sh&#34;&gt;here&lt;/a&gt;.&lt;/strong&gt; This adapter uses a Realtek &lt;strong&gt;RTL8821AU Chipset&lt;/strong&gt; at its heart, which fortunately has linux drivers available, thanks to aircrack-ng!
Executing the commands in the script installed all it&amp;rsquo;s drivers. Now next, i had to enable it and connect to my home network to make the pc accessible by my other devices.&lt;/p&gt;
&lt;p&gt;To do this, here is an excellent guide from &lt;a href=&#34;https://ubuntu.com/core/docs/networkmanager/configure-wifi-connections&#34;&gt;Ubuntu&lt;/a&gt;!&lt;/p&gt;
&lt;p&gt;As for the steps i followed, they were as follow:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Firstly, i had to install &lt;strong&gt;network-manager&lt;/strong&gt; as it was not present by default on the default server installation [ strange? ].&lt;/li&gt;
&lt;li&gt;Next, i ran &lt;strong&gt;&lt;code&gt;nmcli d&lt;/code&gt;&lt;/strong&gt; command to get the name of the wifi device.&lt;/li&gt;
&lt;li&gt;Then, to turn it on, issue: &lt;strong&gt;&lt;code&gt;nmcli r wifi on&lt;/code&gt;&lt;/strong&gt; and list all the scanned wifi networks with: &lt;strong&gt;&lt;code&gt;nmcli d wifi list&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;To connect to one of the networks listed, you have to type: &lt;strong&gt;&lt;code&gt;nmcli d wifi connect &amp;lt;name of the wifi&amp;gt; password &amp;lt;password for that wifi&amp;gt;&lt;/code&gt;&lt;/strong&gt;  [Replace stuff within &amp;lt; &amp;gt; with what you have got listed in the above step.]&lt;/li&gt;
&lt;li&gt;It took several seconds but after that it did get connected to my wifi network! I restarted my pc without the ethernet cable and the wifi did indeed work, although on startup, one of the checks done by systemd made me wait for quite a long time, more on that &lt;a href=&#34;https://askubuntu.com/questions/972215/a-start-job-is-running-for-wait-for-network-to-be-configured-ubuntu-server-17-1&#34;&gt;here&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I then took out the HDD and inserted it into my older desktop and sadly, even after it being turned on for several minutes, i had no green led light show up on the wifi usb adapter [which is used to indicate that the modem is in use by the OS], thus, the older pc was &lt;em&gt;not&lt;/em&gt; turning on properly and i had no way to get to diagnosing the issue as i just didn&amp;rsquo;t have a display [running it headless].&lt;/p&gt;
&lt;p&gt;I think that i will have to indeed get my monitor repaired to continue on with my experimentations on my newly built home server.&lt;/p&gt;
</description>
	</item>
	
	<item>
		<title>Use SSH or Rsync With Android</title>
		<link>https://krishnayadav.xyz/blog/use-ssh-or-rsync-with-android/</link>
		<pubDate>Fri, 26 Apr 2024 09:28:58 +0530</pubDate>
		
		<guid>https://krishnayadav.xyz/blog/use-ssh-or-rsync-with-android/</guid>
		<description>&lt;p&gt;Today, i wanted to send a file from my desktop to my android device. I thought of using rsync for this purpose, which is a tool that i use frequently to sync files between my desktop and my laptop.&lt;/p&gt;
&lt;p&gt;I thought of giving it a try and came across &lt;a href=&#34;https://howtos.davidsebek.com/android-rsync-termux.html&#34;&gt;this great article&lt;/a&gt; that explained just this.&lt;/p&gt;
&lt;h3 id=&#34;note-this-guide-requires-both-the-computer-and-the-android-device-to-be-on-the-same-wifi-network&#34;&gt;NOTE: This guide requires both the computer and the Android device to be on the same wifi network.&lt;/h3&gt;
&lt;p&gt;The process to send files from PC to Android which i took was as follows:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Install rsync on termux using the command: &lt;strong&gt;&lt;code&gt;apt install rsync&lt;/code&gt;&lt;/strong&gt; and install openssh using the command: &lt;strong&gt;&lt;code&gt;apt install openssh&lt;/code&gt;&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Then setup the internal storage of our Android device to be accessible by termux using the command: &lt;strong&gt;&lt;code&gt;termux-setup-storage&lt;/code&gt;&lt;/strong&gt;. Grant termux the permission to access storage when prompted.&lt;/li&gt;
&lt;li&gt;Now, change the sshd config file to allow termux to use SSH port. Termux does not have the permission to use the default SSH port 22, so we will use 8022 port instead. For doing this, edit the ../usr/etc/ssh/sshd_config file by simply using the command: &lt;strong&gt;&lt;code&gt;echo &amp;quot;Port 8022&amp;quot; &amp;gt;&amp;gt; ../usr/etc/ssh/sshd_config&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Let&amp;rsquo;s get the local ip address of our device by using the command: &lt;strong&gt;&lt;code&gt;ifconfig&lt;/code&gt;&lt;/strong&gt;. The ip address should be usually in the end and will be after &amp;ldquo;inet&amp;rdquo; . Or you can just go to Settings app and click on wifi and select the wifi you are connected to and look for the ipv4 address. In either of these 2 cases, the ip address should usually begin with &lt;strong&gt;192.168.xx.xx&lt;/strong&gt; where x&amp;rsquo;s are to be replaced by your ip address part.&lt;/li&gt;
&lt;li&gt;Setup a password for the user by using the command: &lt;strong&gt;&lt;code&gt;passwd&lt;/code&gt;&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Finally, we have to start the SSH daemon. To do this, enter this in termux: &lt;strong&gt;&lt;code&gt;sshd&lt;/code&gt;&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;for-using-ssh-&#34;&gt;For using SSH :&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;Open terminal on your pc and type: &lt;strong&gt;&lt;code&gt;ssh -p 8022 192.168.xx.xx&lt;/code&gt;&lt;/strong&gt; [where the x&amp;rsquo;s are replaced by your ipv4 address part].&lt;/li&gt;
&lt;li&gt;You should now be able to use android terminal through your desktop terminal.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;for-using-rsync-&#34;&gt;For using Rsync :&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Simply enter the command : &lt;strong&gt;&lt;code&gt;rsync -e &#39;ssh -p 8022&#39; &amp;lt;file to transfer from pc&amp;gt; 192.168.xx.xx:/data/data/com.termux/files/home/storage/&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Explanation of some stuff in the above commands :&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The -e command is used to specify the remote shell to use. For more details, check the manpage of rsync.&lt;/li&gt;
&lt;li&gt;The x&amp;rsquo;s replace your ipv4 address parts.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;/data/data/com.termux/files/home/storage/&lt;/strong&gt; is the &amp;ldquo;usual&amp;rdquo; path of the main storage in our Android which the user can access, so we are sending the file from our desktop to our Android device&amp;rsquo;s internal storage using this. You can specify some folder to send the file into directly by simply adding the folder after &lt;strong&gt;storage/&lt;/strong&gt; in the command. If this shows an error message when you try to transfer files, just type: &lt;strong&gt;&lt;code&gt;pwd&lt;/code&gt;&lt;/strong&gt; in termux to get your current directory where you wish to send/receive the files and replace output of this command with the path in the step 1 command above after your phone&amp;rsquo;s ip address.&lt;/li&gt;
&lt;li&gt;This should work in vice-versa as well. Just add the path to copy from Android first and the path to copy to in your desktop after this.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;hr&gt;
&lt;h4 id=&#34;side-note&#34;&gt;Side Note:&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;To avoid entering password all the time while accessing SSH/Rsync, generate a key pair on your pc using the command: &lt;strong&gt;&lt;code&gt;ssh-keygen&lt;/code&gt;&lt;/strong&gt; and then copy it to Android using the command: &lt;strong&gt;&lt;code&gt;ssh-copy-id -p 8022 192.168.xx.xx&lt;/code&gt;&lt;/strong&gt; in your desktop terminal. This will ask you password only once and after authenticating it, you can now just use SSH/Rsync without entering that password which we generated in the &amp;ldquo;Step 5&amp;rdquo; in the beginning.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;REMEMBER&lt;/strong&gt; that the ip address of your android device can change from time to time due to ip addresses being dynamic when using wifi. Or they &amp;ldquo;may&amp;rdquo; change if the router is restarted. In any case, be sure to repeat the &amp;ldquo;Step 4&amp;rdquo; which we did in the beginning to find our local ip address.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
</description>
	</item>
	
	<item>
		<title>Ubuntu Touch Port Part 1</title>
		<link>https://krishnayadav.xyz/blog/ubuntutouchportpart1/</link>
		<pubDate>Thu, 25 Apr 2024 13:38:00 +0530</pubDate>
		
		<guid>https://krishnayadav.xyz/blog/ubuntutouchportpart1/</guid>
		<description>&lt;h1 id=&#34;getting-started&#34;&gt;Getting Started&lt;/h1&gt;
&lt;p&gt;So I recently decided to get more involved in the Android world and came about a &amp;lsquo;new&amp;rsquo; type of OS, known as Ubuntu Touch. I thought a bit on it and decided to start the porting process for it for my device Realme GT Neo 2 [codenamed:bitra].&lt;/p&gt;
&lt;p&gt;I started with the &lt;a href=&#34;https://docs.ubports.com/en/latest/porting/introduction/index.html&#34;&gt;official documentation of UBports&lt;/a&gt; where in they gave some good amount of introduction on how and why certain things needed to be done.&lt;/p&gt;
&lt;p&gt;The guide mentions the use of GSI for devices with Android 8+ and, as my device is indeed treble supported, I think I will head to using GSI only.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://docs.ubports.com/en/latest/porting/build_and_boot/standalone_kernel_build.html&#34;&gt;Standalone Kernel Method (Halium 9 and newer)&lt;/a&gt; is very interesting as it seems to be the least tiresome way for porting among all of the 3 mentioned methods. So I started with this and did the steps as mentioned in the guide.&lt;/p&gt;
&lt;p&gt;The defconfig that i had to use is the &lt;a href=&#34;https://gitlab.com/Krishna-Yadav/android_kernel_realme_sm8250/-/blob/master/arch/arm64/configs/vendor/sm8250_defconfig?ref_type=heads&#34;&gt;sm8250_defconfig&lt;/a&gt;. Next i made a halium.config file as prompted.&lt;/p&gt;
&lt;p&gt;Next, i had to fill in the deviceinfo file. For this purpose, I used the &lt;a href=&#34;https://gitlab.com/ubports/porting/community-ports/android11/xiaomi-poco-x3-pro/xiaomi-vayu&#34;&gt;Poco X3 Pro device branch&lt;/a&gt; as a dummy template and started filling stuff according to it and the guide.&lt;/p&gt;
&lt;p&gt;But I got stuck on the &lt;em&gt;deviceinfo_bootimg_prebuilt_dtb&lt;/em&gt; step as i was not sure where to find my dtb. So i asked this question in the telegram group of Ubports and was recommended to run a script on the &lt;a href=&#34;https://krishnayadav.xyz/bootimageextractionguide/index.html&#34;&gt;boot.img which i had extracted&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The script was by LOS. It can be found &lt;a href=&#34;https://raw.githubusercontent.com/LineageOS/android_system_tools_mkbootimg/lineage-18.1/unpack_bootimg.py&#34;&gt;here&lt;/a&gt; [use it through curl -O options]. And it worked! I was able to get the output from my boot.img using the script by running this command : &lt;strong&gt;&lt;code&gt;python unpack_bootimg.py --boot_img boot.img&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;h2 id=&#34;the-scripts-output-in-normal-format&#34;&gt;&lt;strong&gt;The script&amp;rsquo;s output in normal format.&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;&lt;img src=&#34;https://krishnayadav.xyz/img/pyScriptLOS18.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;
&lt;p&gt;But then, i was recommended to add the option &lt;strong&gt;&lt;code&gt;--format mkbootimg&lt;/code&gt;&lt;/strong&gt; along with the above command to get the outputed text in terms of mkbootimg arguments, as it would output the values that were expected for the &lt;strong&gt;deviceinfo&lt;/strong&gt; file.&lt;/p&gt;
&lt;p&gt;Unfortunately for me though, adding that option to the command gave me an error : &lt;strong&gt;&lt;code&gt;error: unrecognized arguments: --format mkbootimg&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I then thought and checked the latest LOS branch from where i had got that previous script. And i did find an updated script from LOS21 that did have those options that i needed for mkbootimg format. The new script can be found &lt;a href=&#34;https://raw.githubusercontent.com/LineageOS/android_system_tools_mkbootimg/lineage-21.0/unpack_bootimg.py&#34;&gt;here&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;After this, i ran the command again, now with the additional parameters to it and was indeed able to generate the output in mkbootimg format without any errors! The updated command : &lt;strong&gt;&lt;code&gt;python unpack_bootimg.py --boot_img boot.img --format mkbootimg&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;h2 id=&#34;the-scripts-output-in-mkbootimg-format&#34;&gt;&lt;strong&gt;The script&amp;rsquo;s output in mkbootimg format.&lt;/strong&gt;&lt;/h2&gt;
&lt;p&gt;&lt;img src=&#34;https://krishnayadav.xyz/img/pyScriptLOS21.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;
&lt;p&gt;This has given me alot to work with now. I will be looking forward to progress even further and complete the deviceinfo file.&lt;/p&gt;
</description>
	</item>
	
	<item>
		<title>Boot Image Extraction Guide</title>
		<link>https://krishnayadav.xyz/blog/bootimageextractionguide/</link>
		<pubDate>Wed, 24 Apr 2024 21:53:31 +0530</pubDate>
		
		<guid>https://krishnayadav.xyz/blog/bootimageextractionguide/</guid>
		<description>&lt;p&gt;Guide on how to extract a boot image from any Android phone [Requires Magisk and Computer]&lt;/p&gt;
&lt;h2 id=&#34;getting-started&#34;&gt;Getting started!&lt;/h2&gt;
&lt;p&gt;Accessing and modifying system files on your device typically requires superuser permissions. To extract the boot image, we&amp;rsquo;ll need a root environment. We&amp;rsquo;ll achieve this by using Magisk.&lt;/p&gt;
&lt;h4 id=&#34;manual-process&#34;&gt;Manual Process&lt;/h4&gt;
&lt;ol&gt;
&lt;li&gt;First, make sure you install TWRP and then flash Magisk through it.&lt;/li&gt;
&lt;li&gt;Setup Magisk in your phone.&lt;/li&gt;
&lt;li&gt;Connect your phone to your Computer and type adb shell [Ensure that you have adb setup properly].&lt;/li&gt;
&lt;li&gt;Now, become root by typing &lt;strong&gt;su&lt;/strong&gt; in the shell on your PC.&lt;/li&gt;
&lt;li&gt;Copy/Paste the following code in the shell.&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; PARTITION in &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;boot&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;boot_a&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;boot_b&amp;#34;&lt;/span&gt;; &lt;span style=&#34;color:#66d9ef&#34;&gt;do&lt;/span&gt;
  BLOCK&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;$(&lt;/span&gt;find /dev/block &lt;span style=&#34;color:#ae81ff&#34;&gt;\(&lt;/span&gt; -type b -o -type c -o -type l &lt;span style=&#34;color:#ae81ff&#34;&gt;\)&lt;/span&gt; -iname &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;$PARTITION&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt; -print -quit 2&amp;gt;/dev/null&lt;span style=&#34;color:#66d9ef&#34;&gt;)&lt;/span&gt;
  &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt; -n &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;$BLOCK&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;; &lt;span style=&#34;color:#66d9ef&#34;&gt;then&lt;/span&gt;
    echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;$PARTITION&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;$(&lt;/span&gt;readlink -f &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;$BLOCK&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;)&lt;/span&gt;
  &lt;span style=&#34;color:#66d9ef&#34;&gt;fi&lt;/span&gt;
&lt;span style=&#34;color:#66d9ef&#34;&gt;done&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This command will display the boot partition paths for both A/B and A-only devices.&lt;/p&gt;
&lt;h1 id=&#34;note&#34;&gt;Note!&lt;/h1&gt;
&lt;p&gt;On &lt;a href=&#34;https://source.android.com/docs/core/ota/ab&#34;&gt;A/B devices&lt;/a&gt;, the loop command will display the boot partition paths for both slots, something like this!&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;boot_a &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; /dev/block/sda40
boot_b &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; /dev/block/sda41
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In this case, you can extract the image corresponding to your currently active slot.To determine the active slot, enter the command &lt;code&gt;getprop ro.boot.slot_suffix&lt;/code&gt;. If the output is _a, use the path for boot_a; otherwise, use the path for boot_b.&lt;/p&gt;
&lt;ol start=&#34;6&#34;&gt;
&lt;li&gt;Finally, use the following command to extract the image from the specified boot path:&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;dd &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&amp;lt;boot_partition_path&amp;gt; of&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&amp;lt;output_path&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;For example:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;dd &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;/dev/block/mmcblk0p42 of&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;/sdcard/boot_a.img
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;I hope this did work for you, as it did indeed work for me!&lt;/p&gt;
&lt;p&gt;CREDITS : &lt;a href=&#34;https://gist.github.com/gitclone-url/a1f693b64d8f8701ec24477a2ccaab87&#34;&gt;Here&lt;/a&gt;&lt;/p&gt;
</description>
	</item>
	
	<item>
		<title>Donate</title>
		<link>https://krishnayadav.xyz/donate/</link>
		<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
		
		<guid>https://krishnayadav.xyz/donate/</guid>
		<description>&lt;p&gt;If you do like my work, you can donate me here:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Paypal: &lt;a href=&#34;https://paypal.me/krishnayadavxyz&#34;&gt;Link&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;UPI: obsidianmaximus@upi&lt;/p&gt;
&lt;p&gt;QR code for UPI:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://krishnayadav.xyz/upi.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Monero: 46Es9cwspxoY9hhYMy2mdGLwxpYouLWANaBVWiUhhjE37Mr1bB65cU4C9cLkCiaw3hWVaZij7xZs4DrPVUFxTPy5CCkVvsr&lt;/p&gt;
&lt;p&gt;Monero QR:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://krishnayadav.xyz/Monero.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
</description>
	</item>
	
	</channel>
</rss>
