Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
noxOffline
Post subject: fastest way from X to init 3  PostPosted: 23.11.2010, 22:45



Joined: 2010-09-14
Posts: 45

Status: Offline
Hi,

after doing a part of my dist-upgrade in X with the
      Code:
apt-get update && apt-get dist-upgrade -d 

command I often forget to go into init 3 after logging out...

Is there a quick way/command to log out of x, log in as root and going into init 3 in one step??
 
 View user's profile Send private message  
Reply with quote Back to top
devilOffline
Post subject: RE: fastest way from X to init 3  PostPosted: 23.11.2010, 22:49



Joined: 2010-08-26
Posts: 491
Location: Berlin
Status: Offline
init 3 in your konsole in X as root, init 5 to get back after you are done.

greetz
devil
 
 View user's profile Send private message  
Reply with quote Back to top
noxOffline
Post subject:   PostPosted: 23.11.2010, 23:08



Joined: 2010-09-14
Posts: 45

Status: Offline
Oh nice, so there's no real need to first log out and then do the ctrl+alt+F1 thing after all...


Thank you very much.
 
 View user's profile Send private message  
Reply with quote Back to top
se7enOffline
Post subject:   PostPosted: 24.11.2010, 02:43



Joined: 2010-09-11
Posts: 164

Status: Offline
I use a small script called d-u.

      Code:
#!/bin/bash

# This will du as root and ask for root password for normal user

clear;
    echo "********************* Today is a good day to do your du :) *********************"
echo ""
RUNUSER=`id -nu`

if [ "$RUNUSER" != "root" ]
    then
    echo "********************* This script must be executed as root *********************"
    echo ""
    su -c 'apt-get update ; apt-get dist-upgrade -y --force-yes -d'
           echo ""
           echo "****All new packages are downloaded. would you like to change to init 3 to install now? (y/n)****"
           read -n 1 continue
           if [ $continue == y ]; then
           su -c '/etc/init.d/[gkx]dm stop'
           else [$continue == n ]; than
           echo "****Thank you for using me****";
           fi

else
     echo "********************* Running as $RUNUSER, good and verified ! *********************"
     echo ""
     su -c ' apt-get update ; apt-get dist-upgrade -y --force-yes -d'
           echo ""
           echo "****All new packages are downloaded. would you like to change to init 3 to install now? (y/n)****"
           read -n 1 continue
           if [ $continue == y ]; then
           su -c '/etc/init.d/[gkx]dm stop'
           else
           echo "****Thank you for using me****";
           fi

fi


It can be used to only download the packages in X and if you like shut down X after downloading. You will end up in a terminal where you have to log in as root and do you normal apt-get distupgrade ...
 
 View user's profile Send private message  
Reply with quote Back to top
BelaLugosiOffline
Post subject:   PostPosted: 24.11.2010, 18:44



Joined: 2010-09-11
Posts: 49
Location: Dresden / Germoney
Status: Offline
The problem of changing to init3 from X is that your current session won't be saved.

_________________
i don't have hard drives. i just keep 30 chinese teenagers in my basement and force them to memorize numbers (bash.org)
 
 View user's profile Send private message  
Reply with quote Back to top
devilOffline
Post subject:   PostPosted: 24.11.2010, 18:54



Joined: 2010-08-26
Posts: 491
Location: Berlin
Status: Offline
you could also use telinit 3

greetz
devil
 
 View user's profile Send private message  
Reply with quote Back to top
dptOffline
Post subject:   PostPosted: 24.11.2010, 19:31



Joined: 2010-09-11
Posts: 281
Location: New Delhi
Status: Offline
I never had any problem with what is described in the manual.
I do not use/like auto-save, and where I live the power can fail at anytime,
and anyway I prefer to save manually, no auto-saves.

_________________
In a lunatic asylum, everyone thinks that he is the doctor.
 
 View user's profile Send private message AIM Address  
Reply with quote Back to top
phenOffline
Post subject:   PostPosted: 24.11.2010, 19:42



Joined: 2010-09-11
Posts: 27

Status: Offline
devil,
what exactly is the difference between triggering init3 and telinit3 in, say, yakuake?
(Sorry, manpage is not really giving me enough of a clue here).
 
 View user's profile Send private message  
Reply with quote Back to top
devilOffline
Post subject:   PostPosted: 24.11.2010, 20:43



Joined: 2010-08-26
Posts: 491
Location: Berlin
Status: Offline
the manpage hints that telinit is just a symlink to init (telinit waits 5 seconds).
although in a training i am taking i was taught that telinit does not close the user sessions.
i will see if i can find that ifo online.

greetz
devil
 
 View user's profile Send private message  
Reply with quote Back to top
myloOffline
Post subject:   PostPosted: 24.11.2010, 21:33



Joined: 2010-09-11
Posts: 116
Location: Wiesbaden, Germany
Status: Offline
I think what nox looks for as myself does, is an abbrevation of the procedure:

1) in X a console:

update and d-u -s

2) check zhe response and then

to switch to init 3 for understandbale reasons

3) and have to login again after switching to runlevel from 5 to 3
4) so inputting user = "root" and root pw.

If there would be a shorter way, with the same security, I am interested...

_________________
Regards
mylo

Linux 3.1-6.slh.1-aptosid-amd64 x86_64[2010-03 Ἀπάτη (201012262151)]
Intel Core2 Duo E6550 @ Cache/Ram 4MB/4GB nVidia G72 7300 nouveau 2*250GB
 
 View user's profile Send private message  
Reply with quote Back to top
phenOffline
Post subject:   PostPosted: 24.11.2010, 22:49



Joined: 2010-09-11
Posts: 27

Status: Offline
Thanks devil!
I in fact felt like telinit is nothing but a symlink to init, having read the manpage. Your insights I would certainly appreciate!

Anyway, performing init3 in X drops me to a shell to login - is there no way to get to init3 while keeping up my root status? It is more or less annoying to login as root in X, only to trigger init3, then having got there again having to login in as root before I can proceed.
 
 View user's profile Send private message  
Reply with quote Back to top
broweOffline
Post subject:   PostPosted: 25.11.2010, 14:43



Joined: 2010-09-12
Posts: 152
Location: Canada
Status: Offline
      phen wrote:
Thanks devil!
It is more or less annoying to login as root in X, only to trigger init3, then having got there again having to login in as root before I can proceed.


I suggest not to log into X as root. Login as a user, open a terminal, then:

      Code:

sux
apt-get update && apt-get dist-upgrade -d


You can continue using X while the download takes place and you can finish the d-u when your work in X is done. Once the download is done just init 3 and apt-get dist-upgrade. I find this the best way to limit my time in a non-X terminal.
 
 View user's profile Send private message  
Reply with quote Back to top
phenOffline
Post subject:   PostPosted: 25.11.2010, 17:02



Joined: 2010-09-11
Posts: 27

Status: Offline
Okay, thats a missunderstanding, browe. Of course I dont log into X as root, but do "sux" in X, download as you suggest, then "init 3", and heres the bothersome part: Although I entered init3 from within a root shell, I again have to login in init3 to proceed with the d-u.
 
 View user's profile Send private message  
Reply with quote Back to top
dptOffline
Post subject:   PostPosted: 25.11.2010, 17:36



Joined: 2010-09-11
Posts: 281
Location: New Delhi
Status: Offline
Download in X in terminal with -d option.
su
apt-get update
apt-get dist-upgrade -d
CTRL-ALT-F1 to exit X
init 3
apt-get update
apt-get update
apt-get dist-upgrade -d
apt-get dist-upgrade
apt-get clean
init5 && exit

I guess that I correctly remember. Please correct if not
Thanks
dpt

_________________
In a lunatic asylum, everyone thinks that he is the doctor.
 
 View user's profile Send private message AIM Address  
Reply with quote Back to top
broweOffline
Post subject:   PostPosted: 25.11.2010, 18:54



Joined: 2010-09-12
Posts: 152
Location: Canada
Status: Offline
      phen wrote:
Okay, thats a missunderstanding, browe. Of course I dont log into X as root, but do "sux" in X, download as you suggest, then "init 3", and heres the bothersome part: Although I entered init3 from within a root shell, I again have to login in init3 to proceed with the d-u.


I have noticed that after issuing "init 3" from a sux terminal that a new root login is required. The way I understand it though is that the sux terminal is still part of the X-windows (tty7) and init 3 forces tty7 to log off. Since the sux terminal is part of tty7 that too is forced to logoff.

It is possible to d-u from within the sux terminal, but that isn't recommended (ie unsupportable) and may break your system if you upgrade such things as video or xorg.
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT - 12 Hours
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by Zafenio