Author |
Message |
oddball
|
|
Post subject: dist-upgrade WARNING if you are not in init 3
Posted: 23.09.2010, 09:34
|
|

Joined: 2010-09-11
Posts: 109
Location: Skåne, Sweden
Status: Offline
|
|
Could be that I'm alone with this problem but I usually do apt-get dist-upgrade -d in x so I can use my box during downloading. Then I do Ctrl+Alt+F1 and start the real upgrade with apt-get dist-upgrade and just as I did here, I sometimes forget to do init 3.
So far I have been lucky and nothing have broke but it's a problem for me.
Would it be possible to have an aptosid version of apt-get dist-upgrade that checks if you are in init 3 and if not, give you a warning and ask if you want to go on or not?
As I have understood the d-u in init 3 is a special sid/aptosid thing and not necessary in stable Debian, and that this is very important for us using aptosid I think it would be right to have this feature if it's possible. |
|
|
|
|
 |
mylo
|
|
Post subject: RE: dist-upgrade WARNING if you are not in init 3
Posted: 23.09.2010, 09:44
|
|

Joined: 2010-09-11
Posts: 116
Location: Wiesbaden, Germany
Status: Offline
|
|
I think it is always recommended to d-u in init 3, as you do not know, whether X-related packages are to be updated. And that might kill X.
So the easiest way is getting used to do all of this in init 3 and not while working/doing other things. |
_________________ 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
|
|
|
|
 |
gerd
|
|
Post subject: RE: dist-upgrade WARNING if you are not in init 3
Posted: 23.09.2010, 10:11
|
|

Joined: 2010-09-13
Posts: 94
Status: Offline
|
|
Downloading is possible without any problems in X.
To change apt-get dist-upgrade to check if it is in init 3 is not possible, cos it is a aptosid specific "problem" and apt belongs to debian.
But if you forget to init 3 and X crashes it should be no problem (if you have nothing unsaved in the running session, such as open text editors). The main reason to do apt-get du in init 3 is that the console from where you are running the d-u do not belongs to x, so that if X crashes the update process don't crashes to. |
|
|
|
|
 |
|
Post subject: RE: dist-upgrade WARNING if you are not in init 3
Posted: 23.09.2010, 10:38
|
|
Moderator

Joined: 2010-09-11
Posts: 469
|
|
there is a command 'runlevel', which should show something like
Code:
5 3
if you have just changed runlevel 5 to 3 by init 3 command.
If you forgot init 3, it would show
Code:
N 5
the second number is your current runlevel.
So,
(1) you get habit of calling it... (well, same as getting habit of calling 'init 3'
(2) make a small script to check the second number of output and warn you.
(can be also check if you're root, and if not call 'su')
if both ok, proceed...
(eidt: I'm not good at shell scripting... now after effort, I came to this
Code:
if [ "$(runlevel | cut -c3)" -ne "3" ]; then
echo baa;
fi
but what devil wrote below meanwhile is true...
(further edit. was not 'R 5' but 'N 5') |
Last edited by muchan on 23.09.2010, 18:25; edited 2 times in total
|
|
|
|
 |
devil
|
|
Post subject: RE: dist-upgrade WARNING if you are not in init 3
Posted: 23.09.2010, 10:46
|
|

Joined: 2010-08-26
Posts: 491
Location: Berlin
Status: Offline
|
|
you might as well change to TTY by the command 'init 3' in your shell. that prevents you forgetting to switch there and is faster anyways.
greetz
devil |
|
|
|
|
 |
gerd
|
|
Post subject: RE: dist-upgrade WARNING if you are not in init 3
Posted: 23.09.2010, 10:58
|
|

Joined: 2010-09-13
Posts: 94
Status: Offline
|
|
it would be also possible to make a script as alias for apt-get dist-upgrade.
scheme:
.bashrc (for root)
apt-get dist-upgrade -> script
script: init 3 ; /path_to_apt_get/apt-get dist-upgrade
no warranty, but this could work |
|
|
|
|
 |
|
Post subject: RE: dist-upgrade WARNING if you are not in init 3
Posted: 23.09.2010, 11:02
|
|
Moderator

Joined: 2010-09-11
Posts: 469
|
|
what is not good, at least for me, with this aproach of calling init 3 in script is,
if I call it in X termnal, all the application running in X is shutdown...
Sure, I should know it before calling the script, but then, (for me) it's more conscious
to call 'init 3' expricitely myself in the root terminal. |
|
|
|
|
 |
bluewater
|
|
Post subject:
Posted: 23.09.2010, 12:00
|
|
Team Member

Joined: 2010-08-26
Posts: 58
Location: Hobart, Australia
Status: Offline
|
|
who -r
will give the current runlevel |
_________________ If all else fails, get the instructions back out of the rubbish bin and read them. http://manual.aptosid.com/
|
|
|
|
 |
gerd
|
|
Post subject:
Posted: 23.09.2010, 12:11
|
|

Joined: 2010-09-13
Posts: 94
Status: Offline
|
|
bluewater wrote:
who -r
will give the current runlevel
I think it's time for a fresh install here. w, who (with and without -r) in a console gives a empty answer, conky says that 0 user are active... but it's also cool. I'm invisible  |
|
|
|
|
 |
bluewater
|
|
Post subject:
Posted: 23.09.2010, 12:43
|
|
Team Member

Joined: 2010-08-26
Posts: 58
Location: Hobart, Australia
Status: Offline
|
|
gerd
uuuuuuuumm ,,, you run :
who -r
in a terminal, no idea what a system monitor has to do with running a command
eg
$ who -r
run-level 5 2010-09-23 16:36 last=S |
_________________ If all else fails, get the instructions back out of the rubbish bin and read them. http://manual.aptosid.com/
Last edited by bluewater on 23.09.2010, 12:51; edited 1 time in total
|
|
|
|
 |
gerd
|
|
Post subject:
Posted: 23.09.2010, 12:48
|
|

Joined: 2010-09-13
Posts: 94
Status: Offline
|
|
bluewater wrote:
gerd
uuuuuuuumm ,,, you run :
who -r
in a terminal, no idea what a system monitor has to do with running a command
Even if i change with strg+alt+1 to TTY1 and log me in i get nothing if i type who or w. Same when i open a terminal-emulator in the running xfce-session.
(but it's no case for support or something. Probably i played a bit too much with the running processes) |
|
|
|
|
 |
bluewater
|
|
Post subject:
Posted: 23.09.2010, 12:51
|
|
Team Member

Joined: 2010-08-26
Posts: 58
Location: Hobart, Australia
Status: Offline
|
|
hrhr |
_________________ If all else fails, get the instructions back out of the rubbish bin and read them. http://manual.aptosid.com/
|
|
|
|
 |
edhunter
|
|
Post subject:
Posted: 23.09.2010, 13:44
|
|

Joined: 2010-08-26
Posts: 16
Status: Offline
|
|
creating an alias to the apt-get dist-upgrade command would probably be the best way. create a script to check the run level and if the run level is correct do the upgrade otherwise inform the user
init 3 from with-in X means that you lose the current session and thats something i dont want
init 3 ; /path_to_apt_get/apt-get dist-upgrade is not really good as the dist-upgrade command will be executed independently of the exit code of the init 3 command so even if you fail to switch runlevels you will still do a dist-upgrade
init 3 && apt-get dist-upgrade is better as it will only execute a d-u if the runlevel switch is successful. (this will only work if you are already in a tty with alt+ctrl+F1 for example) |
_________________ My blog
|
|
|
|
 |
oddball
|
|
Post subject: Re: RE: dist-upgrade WARNING if you are not in init 3
Posted: 23.09.2010, 16:14
|
|

Joined: 2010-09-11
Posts: 109
Location: Skåne, Sweden
Status: Offline
|
|
devil wrote:
you might as well change to TTY by the command 'init 3' in your shell. that prevents you forgetting to switch there and is faster anyways.
greetz
devil
I don't agree that its faster because you have to be root twice, first su to do init 3 and then log in as root in tty,,,,,, ok if I do it with my method above with d-u -d in x then I'm already superuser and then it's faster, yes you are right as always devil
A script will be some automation which put you a little out of controll. I would still like a little warning if I'm in the wrong runlevel, a warning can be followed or ignored and therefore you will still have full controll, but also a some security if you forget to do right.
edit:
Quote:
creating an alias to the apt-get dist-upgrade command would probably be the best way. create a script to check the run level and if the run level is correct do the upgrade otherwise inform the user
thats a script that makes the warning, good, but couldn't it be inside a aptosid version of apt-get dist-upgrade? |
|
|
|
|
 |
edhunter
|
|
Post subject: RE: Re: RE: dist-upgrade WARNING if you are not in init 3
Posted: 23.09.2010, 16:21
|
|

Joined: 2010-08-26
Posts: 16
Status: Offline
|
|
@oddball: as you probably know we have no custom apt-get dist-upgrade version and I for one wouldn't want to force all our users to use this alias since most dont want/need it but I could help you with a script/alias if you want that |
_________________ My blog
|
|
|
|
 |
|