Linux Tips

More
01 Dec 2011 15:52 #15256 by BigJohnT
BigJohnT created the topic: Linux Tips
If you create g-code files on a separate windows computer and copy the files over your LAN to your Ubuntu computer the file is read only. To make the owner of the file be the same as the Ubuntu computer you need to add one line to the /etc/samba/smb.conf file.

In a terminal:
sudo gedit /etc/samba/smb.conf

Now in the [global] section of /etc/samba/smb.conf add the following line using the actual username:
force user = username

Save and close the file and back in the terminal to restart samba say:
sudo service smbd restart

John
More
17 Feb 2013 01:10 #30197 by ArcEye
ArcEye replied the topic: Linux Tips
Forgotten your password?

This post contains all the main methods for getting back in, one of them will work for you even if you cannot get the GRUB menu up.

www.linuxcnc.org/index.php/english/forum...6171-ubuntu-password
The following user(s) said Thank You: BigJohnT
More
21 Feb 2013 22:34 - 21 Feb 2013 22:40 #30412 by ArcEye
ArcEye replied the topic: Linux Tips
Getting Screen Resolution Correct.
************************************

Ever since Ubuntu stopped using xorg.conf and relied upon HAL and automatic detection of hardware, I have had problems with each new install.
Old monitors are not detected and even new full HD monitors are not detected properly.
Invariably I am left with a max resolution of 1024x768

I have now settled upon a strategy which I have tested up to the latest 12.11 distro running a 3.5.7 kernel.

It relies upon 2 commandline programs cvt and xrandr
They should be part of the basic install, but if not just run $ apt-get install cvt xrandr

($ indicates the command line prompt and is not part of commands)

$ xrandr command without arguments will produce information about your min and max resolutions and your current set up

Screen 0: minimum 320 x 200, current 1920 x 1080, maximum 8192 x 8192
VGA1 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 509mm x 286mm
1920x1080 60.0*+
1600x1200 60.0
1680x1050 60.0
1280x1024 75.0 60.0
1440x900 75.0 59.9
1280x960 60.0
1280x800 59.8
1152x864 75.0
1024x768 75.1 70.1 60.0
832x624 74.6
800x600 72.2 75.0 60.3 56.2
640x480 72.8 75.0 66.7 60.0
720x400 70.1
HDMI1 disconnected (normal left inverted right x axis y axis)
DP1 disconnected (normal left inverted right x axis y axis)
HDMI2 disconnected (normal left inverted right x axis y axis)
DP2 disconnected (normal left inverted right x axis y axis)


You will not get as much output as this (I have 12 screen resolutions already programmed )

cvt will output a 'modeline' based upon the screen width, height and refresh rate arguments input.
These modelines were what used to appear in xorg.conf to define a particular screen resolution

Refresh rate for most LCD monitors will be about 60, but check your manual, getting it wrong could mean screen failure.

$ cvt 1280 1024 60 with my monitor produces
# 1280x1024 59.89 Hz (CVT 1.31M4) hsync: 63.67 kHz; pclk: 109.00 MHz
Modeline "1280x1024_60.00" 109.00 1280 1368 1496 1712 1024 1027 1034 1063 -hsync +vsync


Copy the modeline from the first parenthesis to the end (position the mouse at the left of the first parenthesis
, hold down Shift and drag the mouse to the end to highlight them. Then press Shift Delete. )

Now enter $ xrandr --newmode (then press Shift Insert to paste the modeline)
Now enter $ xrandr --addmode VGA1 1280x1024_60.00 (note no parentheses this time as the mode name is registered)
Then $ xrandr --output VGA1 --mode 1280x1024_60.00 will change screen resolution to 1280 x 1024

(If you are using HDMI or twin headed card with Display Ports (DP1 DP2) you need to read up on how to address them, but basically they replace the VGA1 address)

So now we can use cvt to generate modelines for all the resolutions we want.
We can then make a small script which creates the modes we want, adds them to the output display and then selects one of the modes

For example
#!/bin/bash

    xrandr --newmode "1680x1050_60.00"  146.25  1680 1784 1960 2240  1050 1053 1059 1089 -hsync +vsync
    
    xrandr --addmode VGA1 1680x1050_60.00
    
    xrandr --newmode "1440x900_60.00"  106.50  1440 1528 1672 1904  900 903 909 934 -hsync +vsync
    
    xrandr --addmode VGA1 1440x900_60.00

    xrandr --newmode "1280x1024_60.00"  109.00  1280 1368 1496 1712  1024 1027 1034 1063 -hsync +vsync
    
    xrandr --addmode VGA1 1280x1024_60.00

    xrandr --output VGA1 --mode 1680x1050_60.00

Name this script .xprofile in your home directory and set it executable chmod 755 ./.xprofile

If you are running lxdm (light X display manager) you have done all you need to do
Log out and log back in to take effect. (If it does not do it first time due to caching, run ./.xprofile from your home directory to set it until you reboot again)

You can also make it system wide rather than just per user, by putting the same lines (without the #!/bin/bash) into /etc/lxdm/PreLogin instead (re-boot required)


If you are using gdm (god-awful display manager) installed as default on 10.04, then place the same lines (without the #!/bin/bash)
in /etc/gdm/init/Default just below where the script sets its paths

PATH="/usr/bin:$PATH"
OLD_IFS=$IFS
^ Insert here ^


Re-boot to take effect

If you want to switch screen resolutions during a work session, you can add commands to whatever window manager menu system you have ( I use iceWM, by far the fastest and lightest )
xrandr -s 1280x1024 for instance, will change to that resolution, which you have already added at startup

This is not an exhaustive guide, see man xrandr (cvt, lxdm, gdm) for more, and as with anything Linux, there are another 10 different ways to skin the same cat!

regards
Last Edit: 21 Feb 2013 22:40 by ArcEye.
More
06 Oct 2013 21:31 #39597 by ArcEye
ArcEye replied the topic: Linux Tips - activating the root account and sudo
When doing a fresh install in Debian, you are asked if you want to create a root account and set a password.
Very often however, the root account is not accessable and your user account cannot use sudo either.

This post shows how to set a new root password and add your user to the sudoers list
www.linuxcnc.org/index.php/english/forum...blems?start=50#39381

With Ubuntu, the problem is normally that the root account exists and users can use sudo, but there is no known password for root.
Sometimes it is necessary or desirable to su root(switch user to root) especially if you play around with things at system level.

The technique shown in the first half of the post, will also overcome this, by setting a new password for root.
Moderators: ArcEye
Time to create page: 0.117 seconds
Powered by Kunena Forum