Purchase Linux CDs / DVDs / Flash Drives at OSDisc.com

Welcome to Our Community

While Linux.org has been around for a while, we recently changed management and had to purge most of the content (including users). If you signed up before April 23rd, 2017 please sign up again. Thanks!

Monitor Resolution Problem

Discussion in 'Debian GNU/Linux' started by Terry Mester, Mar 3, 2018.

  1. wizardfromoz

    wizardfromoz Super Moderator
    Staff Member Gold Supporter

    Joined:
    Apr 30, 2017
    Messages:
    1,340
    Likes Received:
    1,529
    In #7, I listed four (4) methods that might assist the OP to remedy his illegible screen output.

    I did not think of a 5th method until much, much later – sometimes even Wizards overlook the bleeding obvious :)

    So without further ado, here is Method 0 (zero):

    METHOD 0 (ZERO)

    STEPS

    1. Boot your PC
    2. At login, enter your password and press enter again
    3. If you are in the same sort of environment as the OP, you will be presented with an illegible screen (it may or may not have been preceded with a splash of coloured shapes). From here, we are working (effectively) “blind”.
    4. Press the Super key aka Windows key, usually between your left Ctrl button and left Alt button, often has a Windows logo on it. This will either open a Search field, or else open your Menu with a Search field activated.
    5. Type in (without the quotes) “terminal”. In Debian, this may offer a number of options including a multilingual terminal, but press Enter anyway. Now we are assuming we have an open Terminal.
    6. In the OP’s case, he has determined, as asked, from the output of “videoinfo” at bootup, that available resolutions include (but may not be limited to) : “1920x1440, 1600x1200, 1280x1024, 1024x768, 800x600, and 640x480”. He further volunteers “It is set at 640x480”, and “The manual for my Ultra VGA Monitor says that it can handle Resolutions up to 1024x768”.

      At this point, he can type in and enter one of the other resolutions, let’s say 800x600. Command is as follows

      Code:
      xrandr --fb 800x600
      - that’s a double-dash before fb. Enter.
    7. An immediate outcome will hopefully be that he has a visible screen? It does not matter whether eg the right-hand side has been shrunk or expanded, icons near a border are missing, or other. He can then go to Menu, and find Settings – Display and open it.



    8. In those settings, it may well be that the default highlighted is the one he does not want, that is 640x480. He can choose 800x600 and Apply it, he may be asked if he wants to keep that resolution, so choose to do so.

    9. Reboot. If all has gone to plan, he will have a visible, legible screen, and can then work his way through those Display settings until he finds one that most closely reflects what he wants.

    It should be noted that using xrandr in this way will, by itself, only last for the session you are in, hence having to continue to tweak the settings from the GUI, in order to have a lasting effect.

    I will provide further options in subsequent Posts, likely daily for a few days, to assist Users in navigational directions.

    Cheers

    Wizard
     
    atanere likes this.
  2. wizardfromoz

    wizardfromoz Super Moderator
    Staff Member Gold Supporter

    Joined:
    Apr 30, 2017
    Messages:
    1,340
    Likes Received:
    1,529
    Before I go on to tell you other methods that will work, I’ll tell you about two (2) which won’t work … that is quite possibly the case under the circumstances experienced by the OP, Terry. They may, however, work for you under certain circumstances, so bear them in mind?

    ISSUING XRANDR COMMAND FROM THE GUI (DESKTOP ENVIRONMENT)

    From the moment we reach the login screen, enter our details and proceed to desktop functionality, we are in the X Environment, that is, graphical.

    Unless we are using Wayland, and then you can’t use xrandr, so we won’t go there.

    From a DE, we can issue a command line instruction from one of two or more ways. I will deal here with only two.

    METHOD ONE – Alt-F2

    If your laptop or desktop PC is set up fortuitously, then Alt-F2 (holding down the Alt key and then pressing and holding the Function 2 key) will open a small popup which allows you to issue a Terminal command, press enter and have it run.

    For example Alt-F2 type in firefox and enter.

    In this scenario, we could issue the xrandr command referred to last Post, and see the instant effect of the screen change. Further, we could do this despite the fact that our initial screen was illegible.

    PROBLEM IS – Many, many keyboards already have a number of the Function keys mapped to certain functions. On my Toshiba Satellite laptop, F1 has a ? on it, and invokes Help, F2 (the one I want) is for reducing screen brightness, F3 for increasing screen brightness, and on and on.

    So no joy there if the OP’s keyboard is in that category, but yours may be different. Of course, once we have a functioning unit again, we can re-map keys, but that is no good to us now.

    METHOD TWO – Ctrl-Alt-t, ie Terminal

    In many Distros, Ctrl-Alt-t will open your Terminal on the desktop, and we could type the xrandr command in, blind.

    That is certainly the case with many of the Debian-based Distros eg Ubuntu, Linux Mint, etc. An exception was Linux Mint 17.0 ‘Qiana’ (all DEs), where it was skipped, but returned with 17.1 ‘Rafaela’.

    PROBLEM IS

    With Debian itself, the shortcut does not exist by default. So no use to the OP.

    I have installed probably over 120 Linux on my computers (currently running 34 on the Toshiba), and with each and every one, the first of maybe 10 things to do after install, right after enabling or checking the firewall is to check that Ctrl-Alt-t opens the CLI, and if not, to create a keyboard shortcut for it.

    I would urge all to do the same, from Novice to Expert.

    In the next Posts, I will be covering two (2) more ways that will work, both under the OP’s circumstances, and likely yours.

    The first will be simply a matter of generating a Folder and a couple of files, and copying them from a Live Medium (CD/DVD/USB) to the stricken system.

    The second can be used as a standalone method, or if the first does not have the conditions met, and it will involve a Live Medium and

    … chroot

    Cheers

    Wizard
     
    atanere likes this.
  3. wizardfromoz

    wizardfromoz Super Moderator
    Staff Member Gold Supporter

    Joined:
    Apr 30, 2017
    Messages:
    1,340
    Likes Received:
    1,529
    WIZARDS GLOSSARY

    DE - Desktop Environment, eg MATE (pronounced like latte), Cinnamon, GNOME &c. For a better comparison, see here -
    https://renewablepcs.wordpress.com/about-linux/kde-gnome-or-xfce/

    FM - File Manager, each DE may have a different one, eg Cinnamon - Nemo, KDE - Dolphin.

    METHOD

    The following method will work, provided that you have the correct install medium. If that sounds like I am hedging my bets, I am not, rather, the problem lies with the diversity of ways Debian provide to install their product.

    If I recollect, the OP, Terry, was/is running Windows XP, and he was planning on dual-booting. It may be the case that he downloaded the Debian .iso to his Windows, and that it is still there for him to check the following. (Actually, I hope he is not running XP with an internet connection, as end of life for XP was April 8 2014, and that would put him at risk.)

    Debian .iso’s come in a variety of formats, and dependent on which of their website’s pages you get them from, your outcomes here will differ. The best page to get them from is here - https://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/

    If you got an iso named similar to the following

    debian-9.4.0-amd64-DVD-1.iso

    … then this method, and the following, which involves chroot, will not work. That is because it has no Live environment, it is purely an installer.

    In order for these proposals to work, you need an iso named similarly to the following:


    debian-live-9.4.0-amd64-gnome.iso

    or

    debian-live-9.4.0-amd64-mate.iso

    or

    debian-live-9.4.0-amd64-cinnamon.iso

    etcetera. “Live” is the key element. The dot points don’t matter so much, 9.4 is the latest, but you may have 9.3, 9.2 etc.

    The following Method I call

    DRAG & DROP CREATED FILES FROM LIVE MEDIUM TO INSTALLED SYSTEM

    The object of the exercise is to create, on your affected Distro, two folders, and two files. All of them will reside in /home/yourusername/.config (note the dot).

    For ease of reference, I will refer to my own circumstances, but for my using my name, which is Chris, you would substitute your own username.

    In /home/chris/.config, I will be creating a Folder “autostart”. Within that, I will be creating another subfolder “scripts”. Within scripts, I will be creating a file “mydisplay.sh”. Then outside of that subfolder scripts, that is, directly under “autostart, I will be creating a file “scripts.desktop”.

    If any of the following seems too complicated, just sing out and I can generate a small video or two illustrating the steps.

    STEPS

    1. Insert your Live medium and boot from it. When you get to the Desktop
    2. Open your File Manager. If you are in Cinnamon, it’s Nemo, GNOME – Nautilus aka Files, MATE – caja, KDE - Dolphin, Xfce – Thunar &c.
    3. Your installed Linux should be viewable either in the left pane and/or in the right pane. Using GNOME's Nautilus, you may have to click in the left pane “+ Other Locations” under the Trash icon. Click Home.
    4. In the pane showing Home’s contents, you may only see perhaps 8 Folders ranging from Desktop to Videos. If so, press Ctrl-h and hidden files and folders will be revealed.
    5. Doubleclick the hidden (sub)folder .config.
    6. Find some empty white space, right-click it and create a new folder and call it “autostart” without the quotes.
    7. Doubleclick “autostart” and within it create a new folder, call it “scripts” without the quotes.
    8. Users of GNOME/Unity should skip to 9.a)
    9. For users of other File Managers – beside the newly-created (sub)folder scripts, right-click white space and create a new file, call it scripts.desktop
    9.a) GNOME/Unity users will need to call up a Text Editor (called gedit) to generate the two files described below. You can do so in GNOME by clicking Activities and where the search field appears mid-top-screen, type in “text” - where its icon appears, right-click and add to Favourites, as you have 2 files to generate.

    As with the other users, your first file will be saved as scripts.desktop.

    10.Inside the new file, type the following:

    Code:
    [Desktop Entry]
    Name=Scripts in 'scripts' folder
    Exec=/bin/bash -c 'for f in ~/.config/autostart/scripts/*; do eval "$f&"; done'
    Type=Application
    X-GNOME-Autostart-Delay=10
    X-GNOME-Autostart-enabled=true

    11. Save the file and exit, or exit, saving the file.If you have followed the above correctly, you should be looking, in your FM at a subfolder called scripts, and beside it, a file called scripts.desktop. Doubleclick the scripts subfolder.

    12. In it, repeat the principles of steps 9 or 9a) above, to create a file called “mydisplay.sh” without the quotes. Open the file.

    13. Inside this file, type the following with the exact syntax, depending on your file editor, the first line may change colour:

    Code:
    #!/bin/bash
    xrandr --fb 1024x768

    That’s a double-dash before “fb”. For the resolution I have used, of 1024x768, you will use one of your already-established options other than the one which is causing you problems.

    Also, regarding the two (2) lines from scripts.desktop which read:

    X-GNOME-Autostart-Delay=10
    X-GNOME-Autostart-enabled=true

    … the X-GNOME usage applies to those with a GNOME DE, but also Ubuntu Unity, Cinnamon DE and MATE DE. MATE users can simply replace GNOME with “MATE” without the quotes. For Linux Mint users of Cinnamon, this applies since version 17 and onwards. I have not the time yet to check out KDE and Xfce, but if you are in that category, let me know.

    14.Save the file. Check within your FM that it is within the subfolder “scripts”. When you do that, right-click the file and choose Properties.

    15. In Properties, go to the bottom and check it to become an executable file, then exit. The changes will be saved on exit.

    OK, we should be ready to go.

    CHECKLIST

    In my affected Distro, the following should be readily found. These additions are to my affected Distro, not to the file structure of my Live Medium, be it DVD or USB, but can be viewed from there, through my File Manager:

    • Under /home/chris/.config – I have a folder autostart
    • within that folder, I have another (subfolder) scripts
    • further, beside that, I can see a file scripts.desktop
    • within the subfolder scripts, I have a file mydisplay.sh, which I have made executable
    If these conditions have been met -

    STEP FINAL

    Close out of the FM, and use the appropriate mechanism to reboot (removing your Live DVD/USB at the right time), or else shutdown and then boot afresh.



    AFTER REBOOT, ENTRY TO DESKTOP AND SCREEN RESOLUTION CHANGE (after 10 seconds or whatever time you chose)

    Armed with the resolution/s you wish to try, you can now go into your Display Settings from your Menu, and choose one to make permanent, or at least lasting.

    CLEANUP

    Having chosen that, if you don't do cleanup, next time you reboot, you will get the funny, oversized, undersized, cut-off, enlarged, whatever, screen again.

    So simply go into the file manager, enter the scripts.desktop file, and at the bottom, change “true” to “false”, save changes and exit. You can clean up properly later, or keep the setup in case you need it, and the “scripts” subfolder is certainly well worth keeping for startup configuration.

    Cheers

    Wizard
     
    atanere likes this.
  4. wizardfromoz

    wizardfromoz Super Moderator
    Staff Member Gold Supporter

    Joined:
    Apr 30, 2017
    Messages:
    1,340
    Likes Received:
    1,529
    The final method I will show for now, I will call

    CHROOT FROM LIVE MEDIUM INTO INSTALLED SYSTEM

    The following applies only to Debian and Debian-based Distros, that includes Debian itself, MX-16 and MX-17, AntiX, Ubuntu, Linux Mint, and others.

    It does not include RPM-based Distros such as Fedora and CentOS, Mageia, OpenMandriva &c, nor Arch-based Distros such as Manjaro. These have their own protocols to get the effect of chroot.

    If you are not sure, ask.

    1. Insert your Live medium and boot from it. When you get to the Desktop
    2. Find Terminal. It will be in your Menu, likely under System Tools. If you are in the GNOME DE, click Activities, then start typing Terminal in the search field. If there are multiple choices, choose the one saying just Terminal. Open it.
    3. Type and enter one or more of the following to establish your normal system partition (root, represented as “/” without the quotes), and any separate boot partition, if present:

    Code:
       sudo blkid
    
            and/or
    
            df -Th
    
            and/or
    
            sudo fdisk -l
    
            (that’s a lowercase “L”)
    It is important each time we use chroot, to be sure we have the right information to hand, as we will be changing or creating files as Root, and we do not wish to brick what is already an incomplete Distro environment. To give you an example, I fired up my laptop the other day, with a Live USB already inserted, and the outputs from the above commands had my USB stick as /dev/sda1 and my hard drive partitions as /dev/sdb1, /dev/sdb2 etc., where it is usually the other way around.

    From the outputs of the above, I can tell that my root or system partition is /dev/sda1 (filesystem EXT4), that I have a separate boot partition /dev/sda2 (formatted to vfat/FAT32), and that I have a Swap partition /dev/sda3 which will not come into play in what follows.

    If you do not have an output line for a separate boot partition, it is likely that you are not on UEFI, but rather BIOS, and you will just ignore one step to follow.


    4. Type and enter the following:

    Code:
    ls -a /.config/autostart
    that’s a lowercase “L”, and note the dot)
    If that returns an error:

    ls: cannot access '/.config/autostart': No such file or directory

    then enter

    Code:
        ls -a /etc/xdg/autostart
    … which will output a number of files ending in .desktop – note the dot.

    We are essentially going to be following the same sort of steps as in the previous Post, but instead of using the GUI (Desktop) we are going to be using the CLI (Command Line Interface, ie Terminal) and chroot.

    You may need to make a decision before using chroot, because we will be Root, and file permissions on the files and folders generated will have their ownership set to Root. If you do not want that to apply in your Home folder or partition, then do the exercise in /etc/xdg/autostart, as everything in /etc already belongs to Root.

    ...but you can always change permissions again after you have a working system :)

    I will call them Option 1 – creates the files and folders in Home, and Option 2 – creates the files and folders in /etc/xdg/


    5. Here we go. Type and enter the following, using your partition identified as being your system partition, in my case it is

    Code:
    sudo mount /dev/sda1 /mnt

    If and only if
    I have determined that I have a separate boot partition, then I follow this with

    Code:
    sudo mount /dev/sda2 /mnt/boot
    6. Type and enter the following, exactly:

    Code:
    for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done

    Then we invoke chroot, watch the prompt change.

    7. Type and enter:

    Code:
    sudo chroot /mnt
    If successful, you will have seen the prompt change from eg [email protected] to [email protected] . We are now inside the File System of your affected Distro on your hard drive, and can make changes that will last.

    The following uses “nano” (Not ANOther text editor). Nano when invoked launches its own shell within your Terminal. Navigation is via your direction keys (arrows). When you have finished entering text, Ctrl-x will commence the save and exit process. Shift-Y will write the changes, the file name will be displayed, and then Enter completes the save and exit.

    OPTION 2 USERS SKIP TO THE SECTION “OPTION 2”, STEPS 14. TO 19. OPTION 1 USERS FOLLOW THESE STEPS.


    8. Type and enter the following, one line at a time, use your username:

    Code:
    mkdir /home/chris/.config/autostart
    cd /home/chris/.config/autostart
    mkdir scripts
    cd scripts
    touch mydisplay.sh
    nano mydisplay.sh
    9. Inside nano’s shell, type the following (use your preferred resolution):

    Code:
    #!/bin/bash
    xrandr --fb 1024x768
    Thats a double dash before fb.

    Type Ctrl-x to begin save and exit, Shift-Y for Yes, see the filename is correct, Enter to save and exit.

    10. Type and enter:

    Code:
    chmod +x mydisplay.sh
    11. Then (note the space)

    Code:
    cd ..
    This brings you up to the previous level.

    12. Type and enter:

    Code:
    touch scripts.desktop
    nano scripts.desktop
    13. Inside nano’s shell, type the following (if you are using MATE, substitute MATE for both references to GNOME. GNOME, Cinnamon and Unity users can use GNOME):

    Code:
    [Desktop Entry]
    Name=Scripts in 'scripts' folder
    Exec=/bin/bash -c 'for f in ~/.config/autostart/scripts/*; do eval "$f&"; done'
    Type=Application
    X-GNOME-Autostart-Delay=07
    X-GNOME-Autostart-enabled=true
    Ctrl-x to begin save and exit, Shift-Y for Yes, see the filename is correct, Enter to save and exit.

    OPTION TWO USERS

    FOLLOW THESE STEPS, AFTER 7. ABOVE

    14. Type and enter the following, one line at a time, use your username:

    Code:
    cd /etc/xdg/autostart
    mkdir scripts
    cd scripts
    touch mydisplay.sh
    nano mydisplay.sh
    15. Inside nano’s shell, type the following (use your preferred resolution):

    Code:
    #!/bin/bash
    xrandr --fb 1024x768
    Type Ctrl-x to begin save and exit, Shift-Y for Yes, see the filename is correct, Enter to save and exit.

    16. Type and enter:

    Code:
    chmod +x mydisplay.sh
    17. Then (note the space)

    Code:
    cd ..
    This brings you up to the previous level.

    18. Type and enter:

    Code:
    touch scripts.desktop
    then

    Code:
    nano scripts.desktop
    19. Inside nano’s shell, type the following (if you are using MATE, substitute MATE for both references to GNOME. GNOME, Cinnamon and Unity users can use GNOME):

    Code:
    [Desktop Entry]
    Name=Scripts in 'scripts' folder
    Exec=/bin/bash -c 'for f in /etc/xdg/autostart/scripts/*; do eval "$f&"; done'
    Type=Application
    X-GNOME-Autostart-Delay=07
    X-GNOME-Autostart-enabled=true
    Ctrl-x to begin save and exit, Shift-Y for Yes, see the filename is correct, Enter to save and exit


    Now we are together, and we are nearly finished.

    To exit chroot

    Code:
    Ctrl-d
    and enter. Your prompt will change back.

    Exit your Terminal. (exit)

    Reboot your computer, removing your Live Medium along the way (or power down and restart, removing the medium in between).

    If all has gone to plan, when you reach your Desktop after login, you may still have your illegible screen for a few seconds, but then it will change to one viewable, albeit different.

    You can then follow the steps from the previous Post to go to your Display Settings and try an alternative resolution.

    If you like the alternative resolution, remember to Clean Up before your reboot.

    Cheers

    Wizard
     
    atanere likes this.

Share This Page