Showing posts with label fedora. Show all posts
Showing posts with label fedora. Show all posts

Friday, 15 September 2017

How to format USB stick in Fedora LXDE via terminal


I always forget this, therefore, I'm writing this really short article as a note.

It's a solution that works for me described on ask.fedoraproject.org

Change to super mode
sudo su

List volumes on your PC
[root@mynotebook ptacnikt]# df
Filesystem                         1K-blocks     Used Available Use% Mounted on
/dev/sda1                             999320   195976    734532  22% /boot
/dev/sdb1                            1305600  1305600         0 100% /run/media/ptacnikt/Xubuntu 17.04 amd64

The USB stick might be /dev/sdb1 like in my case

Unmount it
umount /dev/sdb1

Format it
mkfs.vfat /dev/sdb1

Plug it out, plug it in again and it should work. Done.

Saturday, 26 November 2016

Install XDebug in Fedora25 and configure Netbeans

Installation

It is definitelly worth to read oficial installation docs before proceeding, it's quite short and it can help to avoid basic mistakes that are sometimes recomended elsewhere. You don't have to read it all - just pick the part which you need - pecl  - homebrew - from source.

Installation of XDebug in Fedora is really simple as there is the newest version in Fedora repositories. We can simply use the pecl installation.
> sudo dnf install php-pecl-xdebug


XDebug Configuration

This type of installation already enables xdebug extension. At least in my case the file /etc/php.d/15-xdebug.ini was already there after installation.

Wednesday, 23 November 2016

Cntlm proxy - my experience

When you work in a company where you have to use proxy, some things can get more complicated. In this article I'd like to summarize my settings and experience of using proxy on my linux Fedora27 laptop.

Linux - configuration of a proxy 

Settings of a proxy on linux machines differs per distribution. On some user friendly distributions you can use a Graphical interface and on others, you do it in a configuration file.

The easiest way to find it out for your distribution is to put a phrase like "Fedora 24 proxy configuration" into google, where you replace Fedora 24 with your distribution ;)

For example I use for my proxy configuration file /etc/profile.d/proxy.sh
And it looks almost like the first example file which you'll find via google.
MY_PROXY_URL="http://prox.srv.world:3128/"
HTTP_PROXY=$MY_PROXY_URL
HTTPS_PROXY=$MY_PROXY_URL
FTP_PROXY=$MY_PROXY_URL
http_proxy=$MY_PROXY_URL
https_proxy=$MY_PROXY_URL
ftp_proxy=$MY_PROXY_URL
export HTTP_PROXY HTTPS_PROXY FTP_PROXY http_proxy https_proxy ftp_proxy
export no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com"
Additionaly (in Fedora) you have to specify proxy for dnf in a separate file - /etc/dnf/dnf.conf
For those who don't know dnf is a package manager - similar to apt-get in debian-like distributions.

Tuesday, 25 October 2016

Cntlm daemon restart is slow (Fedora23)

Everything started with 

$ sudo systemctl restart cntlm.service being very slow - it takes a minute or more.

So I started digging why.
I simply tried to stop it and then check how it looks during stopping.

Reproduced in Fedora23 and Fedora24

Running:

$ sudo systemctl start cntlm.service

$ sudo systemctl status cntlm.service -l
● cntlm.service - CNTLM HTTP Accelerator For NTLM Secured Proxies Authenticator
   Loaded: loaded (/usr/lib/systemd/system/cntlm.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2016-10-25 12:34:33 CEST; 6min ago
  Process: 23537 ExecStart=/usr/sbin/cntlm -c /etc/cntlm.conf -U cntlm -P /run/cntlm/cntlmd.pid (code=exited, status=0/SUCCESS)
 Main PID: 23540 (cntlm)
   Memory: 2.5M
      CPU: 257ms
  CGroup: /system.slice/cntlm.service
           └─23540 /usr/sbin/cntlm -c /etc/cntlm.conf -U cntlm -P /run/cntlm/cntlmd.pid

Oct 25 12:39:23 mylaptop cntlm[23540]: 127.0.0.1 CONNECT ssl.gstatic.com:443
Oct 25 12:39:24 mylaptop cntlm[23540]: 127.0.0.1 CONNECT lh5.googleusercontent.com:443
Oct 25 12:39:24 mylaptop cntlm[23540]: 127.0.0.1 CONNECT csi.gstatic.com:443
Oct 25 12:39:24 mylaptop cntlm[23540]: 127.0.0.1 CONNECT plus.google.com:443
Oct 25 12:39:25 mylaptop cntlm[23540]: 127.0.0.1 CONNECT i18n-cloud.appspot.com:443
Oct 25 12:39:26 mylaptop cntlm[23540]: 127.0.0.1 CONNECT play.google.com:443
Oct 25 12:39:27 mylaptop cntlm[23540]: 127.0.0.1 CONNECT play.google.com:443
Oct 25 12:39:40 mylaptop cntlm[23540]: 127.0.0.1 CONNECT webpoolam30e10.infra.lync.com:443
Oct 25 12:40:35 mylaptop cntlm[23540]: 127.0.0.1 CONNECT accounts.google.com:443
Oct 25 12:40:36 mylaptop cntlm[23540]: 127.0.0.1 CONNECT beacons.gvt2.com:443

After recieving stop signal:

$ sudo systemctl stop cntlm.service

$ sudo systemctl status cntlm.service -l

● cntlm.service - CNTLM HTTP Accelerator For NTLM Secured Proxies Authenticator
   Loaded: loaded (/usr/lib/systemd/system/cntlm.service; enabled; vendor preset: disabled)
   Active: deactivating (stop-sigterm) since Tue 2016-10-25 12:41:10 CEST; 11s ago
  Process: 23537 ExecStart=/usr/sbin/cntlm -c /etc/cntlm.conf -U cntlm -P /run/cntlm/cntlmd.pid (code=exited, status=0/SUCCESS)
 Main PID: 23540 (cntlm)
   Memory: 2.5M
      CPU: 260ms
   CGroup: /system.slice/cntlm.service
           └─23540 /usr/sbin/cntlm -c /etc/cntlm.conf -U cntlm -P /run/cntlm/cntlmd.pid
Oct 25 12:39:24 mylaptop cntlm[23540]: 127.0.0.1 CONNECT csi.gstatic.com:443
Oct 25 12:39:24 mylaptop cntlm[23540]: 127.0.0.1 CONNECT plus.google.com:443
Oct 25 12:39:25 mylaptop cntlm[23540]: 127.0.0.1 CONNECT i18n-cloud.appspot.com:443
Oct 25 12:39:26 mylaptop cntlm[23540]: 127.0.0.1 CONNECT play.google.com:443
Oct 25 12:39:27 mylaptop cntlm[23540]: 127.0.0.1 CONNECT play.google.com:443
Oct 25 12:39:40 mylaptop cntlm[23540]: 127.0.0.1 CONNECT webpoolam30e10.infra.lync.com:443
Oct 25 12:40:35 mylaptop cntlm[23540]: 127.0.0.1 CONNECT accounts.google.com:443
Oct 25 12:40:36 mylaptop cntlm[23540]: 127.0.0.1 CONNECT beacons.gvt2.com:443
Oct 25 12:41:10 mylaptop systemd[1]: Stopping CNTLM HTTP Accelerator For NTLM Secured Proxies Authenticator...
Oct 25 12:41:10 mylaptop cntlm[23540]: Signal 15 received, issuing clean shutdown

After waiting a minute or more:

Sunday, 17 January 2016

Resize encrypted lvm partitions in Fedora23

In this article I will describe how to shrink one Logical Volume and extend another one in the same volume group.

My setup

During Fedora23 installation I let the installer to partition my disk automatically. I also checked that I want to encrypt my data.
The installer created Logical Volumes: 50GB root partition, 60GB home and 8GB swap.

After some time of using the system I found out that there is only 15GB left in /home and that there is 40GB of free space in / (root). I've decided that I will extend home and shrink root.

Preparation for the action

I spent some time reading about lvm and also LUKS disk encryption in fedora, and then I found this great page about resizing of lvm encrypted partitions - exactly what I needed, even little bit more.

I will try to describe exactly how it went in my case, so this article should be little bit shorter then the one I linked.

Initialization

When you want to shrink a partition you have to do it in unmounted state. For the root partition it means to boot from a live CD. I used Fedora23 CD for that.

Everybody warns you that you should backup your data before doing this, because you can easily loose them if something goes wrong. As I have all my important data in clouds (Dropbox, Google drive) I just restarted my laptop and booted Fedora live.

Thursday, 14 January 2016

MTP in Fedora23 for Android phone

I've recently installed fresh Fedora23 LXDE spin and when I connected my Android phone with 5.0.2 android version which supports MTP and PTP protocols for transferring files it appeared that it's not supported out of the box.

Luckily the solution is easy. You just need to install one utility.
sudo dnf install gvfs-mtp
After installation I had to restart my notebook (maybe starting some service would be enough, but I wanted to boot with new kernel anyway).

And when I connect the phone by USB cable now it automatically appears in the file manager as LGE Android Phone.

I want to add that at first I was afraid that it doesn't work properly, because when I clicked on the device in the file manager for the fist time, nothing appeared. But it just took some time till the device was scanned and its internal storage appeared.


Wednesday, 6 January 2016

How to fix vagrant hanging when mounting folders on fedora (Fedora firewall configuration for Vagrant NFS synced folders)

Situation

If you use Fedora distribution on your host machine and you configure your vagrant box to use NFS type of synced folders, you might get into trouble with vagrant hanging during mounting of those NFS shared folders.
$ vagrant up
...
...
==> default: Mounting NFS shared folders...

Verify if the firewall configuration is the problem

If you haven't changed default firewall settings, the problem is probably there because Fedora has pretty securely configured firewall by default.

To quickly check if the problem is in the firewall settings you can try to disable it:
sudo systemctl stop firewalld
If you want to double check that firewall is really disabled, you can check iptables rules. Disabled firewall looks like this:
$ sudo iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

But of course disabling the firewall permanently is not a good idea so let's configure it that it allows mounting of NFS folders for the vagrant box.

Don't forget to enable the firewall again:
sudo systemctl start firewalld

Virtualbox network interfaces and fedora firewall

By default Virtualbox uses network interface vboxnet0 but when you reload your vagrant box it might happen that new interface will be created and used by the box (vboxnet1, vboxnet2 etc). So if you see hanged mounting in the future, check if the box uses interface which is allowed in the firewall config.

As I described in my older article about fedora firewall, fedora uses zones into which you assign network interfaces and then you set specific configuration for each zone.

Therefore what we need to do is to assign vboxnet0 (vboxnet1,...) interface into zone "internal" and then allow apropriate ports (services). We can do it via GUI firewall-config or via terminal firewall-cmd.

As clicking into the gui is something what you can probably handle by yourself, I will use the terminal. Another advantage of firewall-cmd is that you can simply copy following commands and paste them intoto your terminal so it's much quicker.

Change the firewall settings to allow NFS mount

sudo su
firewall-cmd --zone internal --add-interface vboxnet0
firewall-cmd --permanent --zone internal --add-service nfs
firewall-cmd --permanent --zone internal --add-service rpc-bind
firewall-cmd --permanent --zone internal --add-service mountd
firewall-cmd --permanent --zone internal --add-port 2049/udp
firewall-cmd --reload

If you do this when nfs directory mounting is hanged you can see that mounting will continue just after you reload the firewall settings.
==> default: Mounting NFS shared folders...
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.

If you got troubles to make it work, just leave a comment and I will try to help.

Thursday, 31 December 2015

Copy paste in terminal via system clipboard in VIM in Fedora 23

The trouble

When you edit a file via vim editor in Fedora 23, then sadly by default you don't have access to the system clipboard. It means that you are not able to copy some text in the editor and then paste it for example to the browser or vice versa.

Luckily this issue has an easy solution.

Test if you need to fix it or not

To test if your vim supports x11 sytem clipboard run
vim --version
I expect that you will see -xterm_clipboard.  Our goal is to make it +xterm_clipboard.

Solution (Redhat/CentOS/Fedora)

sudo dnf install vim-X11
After that you will be able to use vimx command to start vim with xterm_clipboard support.
Try this:
vimx --version
Now you should see the desired +xterm_clipboard.

Test the result

To test it, just open a file in vim, select a text and then go different application where you can paste the text and hit mouse middle button. The selected text should be pasted there.

Tip'n tricks

As an improvement you can add an alias to your .bashrc file to use vimx even when vim command is started. Add this one line to your .bashrc file:
alias vim="vimx"

If you want to find out more about vim and system clipboard check the referred link below.

Source


Thursday, 28 May 2015

Skype opens links in Firefox instead of default browser (Google Chrome) - Fedora 21 LXDE

Check file

~/.local/share/applications/mimeapps.list

make sure that there is

[Default Applications]
text/html=google-chrome.desktop
x-scheme-handler/http=google-chrome.desktop
x-scheme-handler/https=google-chrome.desktop
x-scheme-handler/about=google-chrome.desktop
x-scheme-handler/unknown=google-chrome.desktop


Also check that google chrome is installed and google-chrome.desktop is in /usr/share/applications/


Pages which helped me to solve it:
- askubuntu.com/questions/79305
- askubuntu.com/questions/96080

Thursday, 5 June 2014

Skype opens links in Firefox instead of default browser (Google Chrome) - Fedora 20 LXDE

I found this solution on the web:
 sudo update-alternatives --config x-www-browser  
And then select wanted browser. But it didn't work for me - it did nothig, no output, nothing to select. (I guessed I had no x-www-browser group)

So I created the "x-www-browser" group in alternatives and set google chrome as my default browser by this command:
 sudo update-alternatives --install /usr/bin/x-www-browser x-www-browser /usr/bin/google-chrome 20  

Now when I write
 sudo update-alternatives --list  
I can see that x-www-browser was added.

Also new link was created in "/usr/bin/":
 $ ll /usr/bin/x-www*  
 lrwxrwxrwx. 1 root root 31 Jun 4 10:30 /usr/bin/x-www-browser -> /etc/alternatives/x-www-browser  

And now when I click in skype on a link... it's opened in Chrome ;)