How to create Debian startup script by modifying environment variables

Asked

Viewed 804 times

2

I need to elaborate a startup script that modifies the resolution that Debian puts by default. I currently have the following shell script that does the job:

export XAUTHORITY=/home/giuliana/.Xauthority
xrandr --newmode "1368x768" 85.25 1368 1440 1576 1784 768 771 781 798 -Hsync +Vsync
xrandr --addmode VGA1 "1368x768"
xrandr --output VGA1 --mode "1368x768"

In this script is added a 1368x768 resolution which by default is not supported in Debian 8. After that this resolution is selected. For it to work it is necessary to modify the value of the environment variable XAUTHORITY. The script works if I run it, but when I use the same boot script it doesn’t work. What I did to get him started on boot was:

  1. I added the script in /etc/init. d
  2. I installed the rcconf
  3. I configured the script I called Resolution to run on boot using the rcconf inserir a descrição da imagem aqui

When I reboot, the resolution is not modified. What I noticed is that the variable XAUTHORITY has its modified value equal to /tmp/kde-giuliana/xauth-1000-_0 and not the value I put in the script. But I don’t know who is modifying that value. Some Debian expert could help me?

  • What is your video card?

  • Typing lspci | grep VGA command appears: 00:02.0 VGA compatible controller: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor Integrated Graphics Controller (rev 06)

  • I’m with Fedora, which does not use this traditional boot script structure, and I don’t remember the details of Debian. But in principle, for a simple script like this that does not follow the pattern of startup scripts I would put in /etc/rc.local, although I don’t think this is the problem. The only thing that strikes me is the following: the startup scripts run on the user root, and its file .Xauthority belongs to the user giuliana. I would try to switch to /root/.Xauthority and see if it works. P.S. is just a kick...

1 answer

2


Due to bugged drivers or hardware, the monitor resolution can be detected incorrectly. For example, the EDID data block provided by your monitor may be incorrect or an outdated version of KDE or Xorg may misinterpret it.

Since your board is Intel, installing the following package can help the system detect the proper resolution:

$ sudo apt-get install xserver-xorg-video-intel

Restart and check that the 1368x786 resolution is listed in the settings.

If even your resolution is not detected, you should use the xrandr, as you are already doing. To permanently save, edit the file /etc/kde4/kdm/Xsetup and add your code before the line initctl ... gdm:

xrandr --newmode "1368x768" 85.25 1368 1440 1576 1784 768 771 781 798 -Hsync +Vsync
xrandr --addmode VGA1 "1368x768"
xrandr --output VGA1 --mode "1368x768"

initctl -q emit login-session-start DISPLAY_MANAGER=gdm


There are other less advantageous ways to persist with the customizations of xrandr, through the:

  • .profile: is per user, which means that your login screen will get a strange resolution,
  • xorg.conf: is obsolete and is no longer included in the most recent distros.

If necessary, the instructions for making these modifications are available at ubuntu wiki, but recommend the method by Xsetup that I mentioned.

  • The xserver-xorg-video-intel package I already had. What worked was initctl ... gdm! Thank you very much!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.