summaryrefslogtreecommitdiff
path: root/www/posts/linux/atom.xml
blob: a6022d16f51496f12dec4f9f651963fa2b4056dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title type="text">The Home of David T. Sadler - All Posts About Linux</title>
    <id>https://davidtsadler.com/posts/linux/atom.xml</id>
    <link rel="alternate" type="text/html" href="https://davidtsadler.com/posts/linux/"/>
    <link rel="self" type="application/atom+xml" href="https://davidtsadler.com/posts/linux/atom.xml"/>
    <updated>2021-06-05T12:00:00Z</updated>
    <entry>
    <title type="text">Xrandr: Failed to Get Size of Gamma for Output Default</title>
    <id>https://davidtsadler.com/posts/linux/2021-06-05/xrandr-failed-to-get-size-of-gamma-for-output-default/</id>
    <link rel="alternate" type="text/html" href="https://davidtsadler.com/posts/linux/2021-06-05/xrandr-failed-to-get-size-of-gamma-for-output-default/"/>
    <author><name>David T. Sadler.</name></author>
    <published>2021-06-05T12:00:00Z</published>
    <updated>2021-06-05T12:00:00Z</updated>
    <content type="html">&lt;h1&gt;Xrandr: Failed to Get Size of Gamma for Output Default&lt;/h1&gt;&lt;blockquote&gt;Sat 5th June 2021 By David T. Sadler.&lt;/blockquote&gt;&lt;p&gt;After updating a laptop to Ubuntu 20.04 I found that the resolution of the display was fixed at 1024x1028 with no option in the settings for changing it to correct resolution of 1368x768.&lt;/p&gt;&lt;p&gt;Now normally I would fall back on using the xrandr command to add the missing resolution.&lt;/p&gt;&lt;p&gt;First the output of cvt command gives me the VESA CVT mode lines for the resolution and refresh rate.&lt;/p&gt;&lt;pre&gt;&lt;code class=&quot;shell&quot;&gt;$ cvt 1366 768 60

Modeline &amp;quot;1368x768_60.00&amp;quot;   85.25  1368 1440 1576 1784  768 771 781 798 -hsync +vsync&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This mode is then added with xrandr.&lt;/p&gt;&lt;pre&gt;&lt;code class=&quot;shell&quot;&gt;$ xrandr --newmode &amp;quot;1368x768_60.00&amp;quot;   85.25  1368 1440 1576 1784  768 771 781 798 -hsync +vsync&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The mode can then be associated with the display.&lt;/p&gt;&lt;pre&gt;&lt;code class=&quot;shell&quot;&gt;$ xrandr --addmode default 1368x768_60&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Like I said, normally this is all that is required but in this instance the xrandr command kept displaying the below message and the desired resolution would not be applied.&lt;/p&gt;&lt;pre&gt;&lt;code class=&quot;shell&quot;&gt;xrandr: Failed to get size of gamma for output default&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;After several fruitless attempts at fixing this I eventually found that the nomodeset kernel boot option had been set. This instructs the kernel to not load any video drivers and instead use BIOS modes. Apparently many open source drivers have removed support for non-kernel modes and fall back to using a very basic VESA driver. I'm assuming this basic driver does not support the resolution I want.&lt;/p&gt;&lt;p&gt;With further investigation I found that nomodeset was been specified via grub so removing it meant re-configuring grub by editing /etc/default/grub.&lt;/p&gt;&lt;pre&gt;&lt;code class=&quot;shell&quot;&gt;$ sudo vim /etc/default/grub&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;In this file I located the below line.&lt;/p&gt;&lt;pre&gt;GRUB_CMDLINE_LINUX_DEFAULT=&amp;quot;quiet splash nomodeset&amp;quot;&lt;/pre&gt;&lt;p&gt;I edited this line to remove nomodeset and saved the changes.&lt;/p&gt;&lt;pre&gt;GRUB_CMDLINE_LINUX_DEFAULT=&amp;quot;quiet splash&amp;quot;&lt;/pre&gt;&lt;p&gt;Now all I needed to do was update grub with the new default settings.&lt;/p&gt;&lt;pre&gt;&lt;code class=&quot;shell&quot;&gt;$ sudo update-grub&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;After a reboot the laptop was using the correct resolution and there was no need to use xrandr.&lt;/p&gt;&lt;h3&gt;Links&lt;/h3&gt;&lt;a href=&quot;https://askubuntu.com/questions/207175/what-does-nomodeset-do&quot;&gt;askubuntu/ question regarding nomodeset does.&lt;/a&gt;&lt;a href=&quot;/posts/linux/&quot;&gt;Linux - Read More Posts.&lt;/a&gt;&lt;p&gt;I don't have comments as I don't want to manage them. You can however contact me at the below address if you want to.&lt;/p&gt;&lt;a href=&quot;mailto:david@davidtsadler.com&quot;&gt;Email david@davidtsadler.com&lt;/a&gt;&lt;h3&gt;License&lt;/h3&gt;&lt;a href=&quot;https://creativecommons.org/licenses/by-sa/4.0/&quot;&gt;The contents of this site is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.&lt;/a&gt;&lt;p&gt;Copyright © 2021 David T. Sadler.&lt;/p&gt;&lt;a href=&quot;/&quot;&gt;Return to Homepage.&lt;/a&gt;</content>
</entry><entry>
    <title type="text">Sudo: sorry, you must have a tty to run sudo</title>
    <id>https://davidtsadler.com/posts/linux/2020-07-13/sudo-sorry-you-must-have-a-tty-to-run-sudo/</id>
    <link rel="alternate" type="text/html" href="https://davidtsadler.com/posts/linux/2020-07-13/sudo-sorry-you-must-have-a-tty-to-run-sudo/"/>
    <author><name>David T. Sadler.</name></author>
    <published>2020-07-13T12:00:00Z</published>
    <updated>2020-07-13T12:00:00Z</updated>
    <content type="html">&lt;h1&gt;Sudo: sorry, you must have a tty to run sudo&lt;/h1&gt;&lt;blockquote&gt;Mon 13th July 2020 By David T. Sadler.&lt;/blockquote&gt;&lt;p&gt;I have found Deployer to be a great tool for deploying PHP applications. However when first setting out to use it I soon came across the error message 'sudo: sorry, you must have a tty to run sudo'. After some investigation I found that the error was triggered when Deployer was running commands via sudo. For those that don't know Deployer works by executing commands on your servers via ssh and depending on your server's configuration there could be issues when sudo is one of those commands.&lt;/p&gt;&lt;h2&gt;What is meant by 'sudo: sorry, you must have a tty to run sudo'?&lt;/h2&gt;&lt;p&gt;When sudo is executed the file /etc/sudoers is read to determine which users or groups can use sudo and what commands they can run. It actually does a bit more than that and you should read the manual for more information.&lt;/p&gt;&lt;p&gt;If you examine the sudoers file you will find that it contains the setting Defaults requiretty. This means that sudo can only be ran from a real tty. In other words if a user wants to run sudo they must have logged into a terminal before hand. This is normally a security feature so that sudo can't be ran from things such as cron jobs. However, it also means that you will have issues when running sudo from another machine via ssh as you also won't be logged into an actual terminal.&lt;/p&gt;&lt;h2&gt;How to resolve the issue?&lt;/h2&gt;&lt;p&gt;If you're happy to change the setting for all users simply use visudo to edit /etc/sudoers and change Defaults requiretty to Defaults !requiretty. Alternatively you can remove the tty requirement for a single user. In fact that is what I do when using Deployer. Since it connects to the server using a user called deployer I add the below configuration with visudo.&lt;/p&gt;&lt;pre&gt;&lt;code class=&quot;shell&quot;&gt;Defaults:deployer !requiretty
deployer ALL=(ALL) NOPASSWD:/usr/bin/chown, /usr/bin/tee, /usr/sbin/apachectl&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This configuration allows the deployer user to execute sudo when not logged into a real terminal and additionally not prompt for a password when executing chown, tee, and apachectl.&lt;/p&gt;&lt;h2&gt;Using Pseudo-tty&lt;/h2&gt;&lt;p&gt;An alternative is to use the pseudo-tty option when connecting via ssh.&lt;/p&gt;&lt;pre&gt;&lt;code class=&quot;shell&quot;&gt;$ ssh -t user@example.com sudo apachectl restart&lt;/code&gt;&lt;/pre&gt;&lt;h3&gt;Links&lt;/h3&gt;&lt;a href=&quot;https://deployer.org/&quot;&gt;Deployer - A Deployment Tool for PHP.&lt;/a&gt;&lt;a href=&quot;https://www.sudo.ws/man/sudoers.man.html&quot;&gt;Sudo Manual.&lt;/a&gt;&lt;a href=&quot;/posts/linux/&quot;&gt;Linux - Read More Posts.&lt;/a&gt;&lt;p&gt;I don't have comments as I don't want to manage them. You can however contact me at the below address if you want to.&lt;/p&gt;&lt;a href=&quot;mailto:david@davidtsadler.com&quot;&gt;Email david@davidtsadler.com&lt;/a&gt;&lt;h3&gt;License&lt;/h3&gt;&lt;a href=&quot;https://creativecommons.org/licenses/by-sa/4.0/&quot;&gt;The contents of this site is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.&lt;/a&gt;&lt;p&gt;Copyright © 2021 David T. Sadler.&lt;/p&gt;&lt;a href=&quot;/&quot;&gt;Return to Homepage.&lt;/a&gt;</content>
</entry>
</feed>